﻿using Abp.Application.Services.Dto;
using Abp.Domain.Repositories;
using Abp.Extensions;
using Abp.Linq.Extensions;
using Abp.UI;
using Camc.Quality.Authorization.Users;
using Camc.Quality.Bop.Dto;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using Camc.Quality.Bop;
using Camc.Quality.Bop.TreeObject;
using Camc.Quality.QualityAnalysis.RTechniqueEntity;
using Camc.Quality.QualityAnalysis.BasicInfoTable;
using Camc.Quality.Dto.QualityPlatformDto;
using Camc.Quality.Dto.TableDto.RbopDto;
using Camc.Quality.Quality;
using Camc.Quality.QualityAnalysis.RFormClass;
using Camc.Quality.QualityAnalysis.RFormBase;
using Camc.Quality.Storage;
using Camc.Quality.Dto;
using Camc.Quality.Dto.TableDto.BopDto;
using Newtonsoft.Json;
using Camc.Quality.Bop.QualityDto;
using Camc.Quality.Common;
using System.IO;
using Abp.EntityFrameworkCore.Repositories;
using System.IO.Compression;
using Microsoft.AspNetCore.Http;
using Camc.Quality.Quality.TransformHtml;
using System.Security.Cryptography;
using System.Text;
using Camc.Quality.ProcessRoute;
using Abp.Domain.Uow;
using Camc.Quality.ProductionPlan;
using EFCore.BulkExtensions;
using System.Data.SqlClient;
using Abp;
using Camc.Quality.IOperationHistory;
using Camc.Quality.OperationHistory;
using System.Reflection;
using System.ComponentModel;
using Camc.Quality.Dto.TableDto;
using Camc.Quality.Dto.TableReturnDto.Technique;
using System.Text.RegularExpressions;
using Camc.Quality.Dto.TableDto.BopDto.Substance;
using Camc.Quality.StoreManagement.StoragePut;

namespace Camc.Quality.QualityPlatform
{
    /// <summary>
    /// 质量平台
    /// </summary>
    public class QualityPlatformAppService : QualityAppServiceBase
    {
        public List<TreeClass> treeNodes = new List<TreeClass>();
        //public int NodeLevel = 1;
        //public int PreNodeLevel;
        private readonly IRepository<RbopDesc, Guid> _rBopDescRepository;
        private readonly IRepository<RbopNode, Guid> _rBopNodeRepository;
        private readonly IRepository<RbopContent, Guid> _rbopContentRepository;
        private readonly IRepository<RTechniqueEntity, Guid> _rtechniqueEntity;

        private readonly IRepository<TechniqueEntity, Guid> _techniqueEntity;
        private readonly IRepository<RProcessesEntity, Guid> _rprocessesEntity;
        private readonly IRepository<RWorkStepEntity, Guid> _rworkStepEntity;
        private readonly IRepository<AnalysisTableInfor, Guid> _analysisTableInfor;
        private readonly IRepository<RTableBase, Guid> _rTableBaseEntity;
        private readonly IRepository<RInspectionSignatureEntity, Guid> _rInspectionSignatureEntity;
        private readonly IRepository<RRecordRequirementsEntity, Guid> _rRecordRequirementsEntity;
        private readonly ITempFileCacheManager _tempFileCacheManager;
        private readonly IRepository<RLoadPieceEntity, Guid> _rLoadPieceRepository;
        private readonly IRepository<RMakeResourcesEntity, Guid> _rMakeResourcesEntityRepository;
        private readonly IRepository<RVideoEntity, Guid> _rVideoEntityRepository;
        private readonly IRepository<TreeVersionLog, int> _treeVersionLogRepository;

        private readonly IRepository<RConvertFormBase, Guid> _rConvertFormBaseEntity;
        private readonly IUnitOfWorkManager _unitOfWorkManager;
        private readonly IRepository<MakeTask, Guid> _makeTaskRepository;
        private readonly IOperationHistoryAppService _iOperationHistoryAppService;
        private readonly IRepository<EditFileProcess, Guid> _editFileProcessRepository;
        private readonly IRepository<ClearSignatureRecord, Guid> _clearSignatureRecordRepository;
        private readonly IRepository<StoreStockContent, Guid> _storeStockContentRepository;
        private readonly IRepository<StorePutContent, Guid> _storePutContentRepository;
        public QualityPlatformAppService(IRepository<ClearSignatureRecord, Guid> clearSignatureRecordRepository, IRepository<EditFileProcess, Guid> editFileProcessRepository, IRepository<RbopDesc, Guid> bopDescRepository,
                                         IRepository<RbopNode, Guid> bopNodeRepository,
                                         IRepository<RbopContent, Guid> rbopContentRepository,
                                         IRepository<RTechniqueEntity, Guid> rtechniqueEntity,
                                         IRepository<TechniqueEntity, Guid> techniqueEntity,
                                         IRepository<RProcessesEntity, Guid> rprocessesEntity,
                                         IRepository<RWorkStepEntity, Guid> rworkStepEntity,
                                         IRepository<AnalysisTableInfor, Guid> analysisTableInfor,
                                         IRepository<RTableBase, Guid> rTableBaseEntity,
                                         IRepository<RRecordRequirementsEntity, Guid> rRecordRequirementsEntity,
                                         IRepository<RLoadPieceEntity, Guid> rLoadPieceRepository,
                                         IRepository<RMakeResourcesEntity, Guid> rMakeResourcesEntityRepository,
                                         IRepository<RVideoEntity, Guid> rVideoEntityRepository,
                                         ITempFileCacheManager tempFileCacheManager,
                                         IRepository<RInspectionSignatureEntity, Guid> rInspectionSignatureEntity,
                                         IRepository<TreeVersionLog, int> treeVersionLogRepository,
                                         IRepository<RConvertFormBase, Guid> rConvertFormBaseEntity,
                                         IUnitOfWorkManager unitOfWorkManager,
                                         IRepository<MakeTask, Guid> makeTaskRepository,
                                         IOperationHistoryAppService iOperationHistoryAppService,
                                         IRepository<StoreStockContent, Guid> storeStockContentRepository,
                                         IRepository<StorePutContent, Guid> storePutContentRepository

            )
        {
            _storePutContentRepository = storePutContentRepository;
            _storeStockContentRepository = storeStockContentRepository;
            _clearSignatureRecordRepository = clearSignatureRecordRepository;
            _editFileProcessRepository = editFileProcessRepository;
            _rBopDescRepository = bopDescRepository;
            _rBopNodeRepository = bopNodeRepository;
            _rbopContentRepository = rbopContentRepository;
            _rtechniqueEntity = rtechniqueEntity;
            _rprocessesEntity = rprocessesEntity;
            _rworkStepEntity = rworkStepEntity;
            _analysisTableInfor = analysisTableInfor;
            _rTableBaseEntity = rTableBaseEntity;
            _rRecordRequirementsEntity = rRecordRequirementsEntity;
            _techniqueEntity = techniqueEntity;
            _rLoadPieceRepository = rLoadPieceRepository;
            _rMakeResourcesEntityRepository = rMakeResourcesEntityRepository;
            _rVideoEntityRepository = rVideoEntityRepository;
            _tempFileCacheManager = tempFileCacheManager;
            _rInspectionSignatureEntity = rInspectionSignatureEntity;
            _treeVersionLogRepository = treeVersionLogRepository;
            _rConvertFormBaseEntity = rConvertFormBaseEntity;
            _unitOfWorkManager = unitOfWorkManager;
            _makeTaskRepository = makeTaskRepository;
            _iOperationHistoryAppService = iOperationHistoryAppService;
        }


        /// <summary>
        /// 根据节点获取当前的工艺规程
        /// </summary>
        /// <param name="id"></param>
        /// <param name="techniqueName"></param>
        /// <param name="techniqueNumber"></param>
        /// <param name="isExport"></param>
        /// <returns></returns>
        public List<TechSelctResult> GetRTechListByNodeId(Guid id, string techniqueName, string techniqueNumber, bool? isExport)
        {
            List<TechSelctResult> teches = new List<TechSelctResult>();
            if (id != Guid.Empty)
            {
                int route = RouteType(id);
                if (route == 1)
                {
                    var techIds = _rBopNodeRepository.GetAll().Where(d => d.RbopDescId == id).Where(d => d.RtechniqueEntityId != null).Select(d => d.RtechniqueEntityId).ToList();
                    if (techIds.Count() > 0)
                    {
                        //var modifRes = _modifyManageRepository.GetAll().Where(d => d.DocumentStatus == DocumentStatus.审核中).Select(d => d.TechniqueId).ToList();
                        //if (modifRes.Count() > 0)
                        //{
                        //    for (int i = 0; i < techIds.Count; i++)
                        //    {
                        //        if (modifRes.FindIndex(d => d == techIds[i]) != -1)
                        //        {
                        //            techIds.Remove(techIds[i]);
                        //        }
                        //    }
                        //}
                        teches = (from cc in _rtechniqueEntity.GetAll()
                                  join ee in _rBopNodeRepository.GetAll() on cc.Id equals ee.RtechniqueEntityId
                                  join mm in techIds on cc.Id equals mm
                                  select new TechSelctResult
                                  {
                                      Id = cc.Id,
                                      TechniqueName = cc.TechniqueName,
                                      TechniqueNumber = cc.TechniqueNumber,
                                      //  Edition = cc.Edition,
                                      //  FileStatusDesc = GetEnumDesc(cc.FileStatus),
                                      //  BopExprot = ee.BopExprot,
                                      //   PlanExprot = ee.PlanExprot,
                                  }).ToList();
                    }
                }
                if (route == 2)
                {
                    var bopNode = _rBopNodeRepository.Get(id);
                    var techIds = _rBopNodeRepository.GetAll().Where(d => d.NodeCode.StartsWith(bopNode.NodeCode) && d.RbopDescId == bopNode.RbopDescId).Where(d => d.RtechniqueEntityId != null).Select(d => d.RtechniqueEntityId).ToList();
                    if (techIds.Count() > 0)
                    {
                        //var modifRes = _modifyManageRepository.GetAll().Where(d => d.DocumentStatus == DocumentStatus.审核中).Select(d => d.TechniqueId).ToList();
                        //if (modifRes.Count() > 0)
                        //{
                        //    for (int i = 0; i < techIds.Count; i++)
                        //    {
                        //        if (modifRes.FindIndex(d => d == techIds[i]) != -1)
                        //        {
                        //            techIds.Remove(techIds[i]);
                        //        }
                        //    }
                        //}
                        teches = (from cc in _rtechniqueEntity.GetAll()
                                  join ee in _rBopNodeRepository.GetAll() on cc.Id equals ee.RtechniqueEntityId
                                  join mm in techIds on cc.Id equals mm
                                  select new TechSelctResult
                                  {
                                      Id = cc.Id,
                                      TechniqueName = cc.TechniqueName,
                                      TechniqueNumber = cc.TechniqueNumber,
                                      //  Edition = cc.Edition,
                                      //    FileStatusDesc = GetEnumDesc(cc.FileStatus),
                                      //    BopExprot = ee.BopExprot,
                                      //    PlanExprot = ee.PlanExprot,
                                  }).ToList();
                    }
                }
                if (route == 3)
                {
                    var bopNode = _rBopNodeRepository.Get(id);
                    if (bopNode.RtechniqueEntityId != null)
                    {
                        var tech = _rtechniqueEntity.GetAll().Where(d => d.Id == bopNode.RtechniqueEntityId.Value).FirstOrDefault();
                        // var modifRes = _modifyManageRepository.GetAll().Where(d => d.DocumentStatus == DocumentStatus.审核中).Select(d => d.TechniqueId).ToList();
                        if (tech != null)
                        {
                            //if (modifRes.Count > 0)
                            //{
                            //    if (modifRes.FindIndex(d => d == tech.Id) == -1)
                            //    {
                            //        TechSelctResult temp = new TechSelctResult();
                            //        temp.Id = tech.Id;
                            //        temp.TechniqueName = tech.TechniqueName;
                            //        temp.TechniqueNumber = tech.TechniqueNumber;
                            //        teches.Add(temp);
                            //    }
                            //}
                            //else
                            //{
                            TechSelctResult temp = new TechSelctResult();
                            temp.Id = tech.Id;
                            temp.TechniqueName = tech.TechniqueName;
                            temp.TechniqueNumber = tech.TechniqueNumber;
                            //  temp.Edition = tech.Edition;
                            // temp.FileStatusDesc = GetEnumDesc(tech.FileStatus);
                            // temp.BopExprot = bopNode.BopExprot;
                            // temp.PlanExprot = bopNode.PlanExprot;
                            teches.Add(temp);
                            //}
                        }
                    }

                }
            }
            if (teches.Count == 0)
            {
                return new List<TechSelctResult>();
            }
            if (isExport == null)
            {
                return teches.AsQueryable().WhereIf(!string.IsNullOrEmpty(techniqueName), d => d.TechniqueName.Contains(techniqueName)).WhereIf(!string.IsNullOrEmpty(techniqueNumber), d => d.TechniqueNumber.Contains(techniqueNumber)).OrderBy(d => d.BopExprot).ToList();
            }
            else
            {
                return teches.AsQueryable().WhereIf(!string.IsNullOrEmpty(techniqueName), d => d.TechniqueName.Contains(techniqueName)).WhereIf(!string.IsNullOrEmpty(techniqueNumber), d => d.TechniqueNumber.Contains(techniqueNumber)).Where(d => d.BopExprot == isExport).ToList();
            }

        }
        /// <summary>
        /// 根据枚举获取枚举描述信息
        /// </summary>
        /// <param name="parm"></param>
        /// <returns></returns>
        private static string GetEnumDesc(System.Enum parm)
        {
            FieldInfo enumInfo = parm.GetType().GetField(parm.ToString());
            if (enumInfo == null)
            {
                return "";
            }
            DescriptionAttribute[] enumAttributes
                = (DescriptionAttribute[])enumInfo.GetCustomAttributes(typeof(DescriptionAttribute), false);
            if (enumAttributes.Length > 0)
            {
                return enumAttributes[0].Description;
            }
            return parm.ToString();
        }
        /// <summary>
        /// 查找当前节点类型 1 任务-节点  2 节点-节点 3 节点-工序 4 工序-工步 5 工步
        /// </summary>
        /// <param name="ParentId"></param>
        /// <returns></returns>
        private int RouteType(Guid ParentId)
        {
            var bopDesc = _rBopDescRepository.GetAll().Where(d => d.Id == ParentId).FirstOrDefault();
            if (bopDesc != null)
            {
                return 1;
            }
            var bopNode = _rBopNodeRepository.GetAll().Where(d => d.Id == ParentId).FirstOrDefault();
            if (bopNode != null)
            {
                if (!string.IsNullOrEmpty(bopNode.ProcessCode))
                {
                    return 3;
                }
                else
                {
                    return 2;
                }
            }
            var processEntity = _rprocessesEntity.GetAll().Where(d => d.Id == ParentId).FirstOrDefault();
            if (processEntity != null)
            {
                return 4;
            }
            var workEntity = _rworkStepEntity.GetAll().Where(d => d.Id == ParentId).FirstOrDefault();
            if (workEntity != null)
            {
                return 5;
            }
            return 0;
        }
        /// <summary>
        /// 总装质量数据清单
        /// </summary>
        /// <param name="input">型号、发次、图号</param>
        /// <returns></returns>
        public async Task<PagedResultDto<RbopDescOutput>> GetQualityTaskList(GetBopDescListInput input)
        {
            //已导出Status=3
            var query = _rBopDescRepository.GetAll().Where(x => x.Status == (Status)(3))
                .WhereIf(!input.Filter.IsNullOrWhiteSpace(),
                x => x.Model.Contains(input.Filter) ||
                x.LotNo.Contains(input.Filter) ||
                x.ModelName.Contains(input.Filter) ||
                x.StageSign.Contains(input.Filter) ||
                x.DrawingNo.Contains(input.Filter)
                ).WhereIf(!input.Model.IsNullOrWhiteSpace(), x => x.Model.Contains(input.Model)
                ).WhereIf(!input.LotNo.IsNullOrWhiteSpace(), x => x.LotNo.Contains(input.LotNo)
                ).WhereIf(!input.DrawingNO.IsNullOrWhiteSpace(), x => x.DrawingNo.Contains(input.DrawingNO));

            var count = await query.CountAsync();
            var bopDescList = await query.OrderBy(input.Sorting).PageBy(input).ToListAsync();
            var list = ObjectMapper.Map<List<RbopDescOutput>>(bopDescList);
            var tempData = from cc in _makeTaskRepository.GetAll()
                           select new
                           {
                               Lono = cc.LotNo,
                               Model = cc.Model,
                               RocketState = cc.RocketState,
                           };
            foreach (var item in list)
            {
                //var user = await UserManager.GetUserByIdAsync((long)item.CreatorUserId);
                //item.UserName = user.Surname;
                // + user.Name;
                                             //通过Map实现了
                                             //item.StatusDesc = ((Status)(item.Status)).ToString();
                                             //item.QualityStatusDesc= ((QualityStatus)(item.QualityStatus)).ToString();

                var treeVersion = await _treeVersionLogRepository.FirstOrDefaultAsync(d => d.ModelId == item.ModelId && d.LotNoId == item.LotNoId && d.Type == 1);
                if (treeVersion != null)
                {
                    item.Version = treeVersion.Version;
                }
                else
                {
                    item.Version = 0;
                }
                var rocketStateData = tempData.Where(d => d.Lono == item.LotNo && d.Model == item.Model).FirstOrDefault();
                if (rocketStateData != null)
                {
                    item.RocketState = rocketStateData.RocketState;
                }
            }
            return new PagedResultDto<RbopDescOutput>(count, list);
        }
        /// <summary>
        /// 自建节点树递归生成
        /// </summary>
        /// <param name="parentNode"></param>
        /// <param name="ParentId"></param>
        private void BindTree(TreeClass parentNode, Guid ParentId)
        {
            var bopNodeList = _rBopNodeRepository.GetAll().Where(c => c.ParentId == ParentId).OrderBy(d => d.CreationTime);
            //var list = ObjectMapper.Map<List<BopNodeDto>>(bopNodeList);
            foreach (var item in bopNodeList)
            {
                TreeClass tree = new TreeClass();
                tree.Id = item.Id;
                tree.ParentId = item.ParentId;
                tree.NodeDrawingNo = item.NodeDrawingNo;
                tree.NodeName = item.NodeName;
                if (string.IsNullOrEmpty(item.ProcessCode))
                {
                    tree.IsRelation = 0;
                }
                else
                {
                    tree.IsRelation = 1;
                    tree.RtechniqueEntityId = item.RtechniqueEntityId;
                    var tech = _rtechniqueEntity.GetAll().Where(d => d.Id == item.RtechniqueEntityId).FirstOrDefault();
                    if (tech != null)
                    {
                        tree.ReturnStatus = tech.ReturnStatus;
                    }
                }
                tree.NodeLevel = item.NodeLevel;
                tree.ParentCode = item.ParentCode;
                tree.NodeCode = item.NodeCode;
                tree.IsLeaf = item.IsLeaf;
                tree.IsExport = item.IsExport;
                tree.PadName = item.PadName;
                tree.PadId = item.PadId;
                tree.IsReturn = item.IsReturn;
                //递归性质，函数内调用自身函数
                //NodeLevel++;
                BindTree(tree, item.Id);
                //NodeLevel--;
                //递归结束的终点条件
                if (parentNode == null)
                {
                    treeNodes.Add(tree);
                }
                else
                {
                    parentNode.children.Add(tree);
                }
            }
        }
        /// <summary>
        ///质量Tree Show
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public List<TreeClass> GetQualityTreeList(GetBopNodeTreeListInput input)
        {
            BindTree(null, input.BopId);
            return treeNodes;
        }
        /// <summary>
        /// 循环生成工序和工步树
        /// </summary>
        /// <param name="NodeId"></param>
        private void BindWorkStep(Guid NodeId)
        {
            //获取节点信息的工艺规程编码
            var bomNode = _rBopNodeRepository.FirstOrDefault(x => x.Id == NodeId);
            if (bomNode.RtechniqueEntityId == null) return;
            Guid techniqueEntityId = (Guid)(bomNode.RtechniqueEntityId);
            //根据工艺规程编码获取工艺文件表Id
            var tech = _rtechniqueEntity.FirstOrDefault(x => x.Id == techniqueEntityId);
            if (tech != null)
            {
                Guid techId = tech.Id;
                //获取工序和工步的信息，并做相应的排序
                var processesList = _rprocessesEntity.GetAllIncluding(p => p.WorkStepEntities).Where(p => p.RTechniqueEntityId == techId).OrderBy(n => n.ProcessesSequence).ToList();
                processesList.ToList().ForEach(q => q.WorkStepEntities = q.WorkStepEntities.OrderBy(r => r.WorkStepNumber).ToList());
                //循环遍历，往Node里面赋值
                foreach (var item in processesList)
                {
                    TreeClass tree = new TreeClass();
                    tree.Id = item.Id;
                    tree.ParentId = NodeId;
                    tree.NodeDrawingNo = "工序" + item.ProcessesSequence.ToString() + " ";
                    tree.NodeName = item.ProcessesName;
                    tree.IsRelation = 0;
                    tree.NodeLevel = 8;
                    //查询工步
                    foreach (var witem in item.WorkStepEntities)
                    {
                        TreeClass wtree = new TreeClass();
                        wtree.Id = witem.Id;
                        wtree.ParentId = item.Id;
                        wtree.NodeDrawingNo = "工步" + item.ProcessesSequence.ToString() + "-";// + witem.WorkStepNumber.ToString();
                        wtree.NodeName = witem.WorkStepNumber.ToString();//witem.WorkStepName  这个值数据库有问题
                        wtree.IsRelation = 0;
                        wtree.NodeLevel = 9;
                        tree.children.Add(wtree);
                    }
                    treeNodes.Add(tree);
                }
            }
        }
        /// <summary>
        /// 工序和工步树的生成
        /// </summary>
        /// <param name="NodeId"></param>
        /// <returns></returns>
        public List<TreeClass> GetQualityWorkStepList(Guid NodeId)
        {
            treeNodes.Clear();
            BindWorkStep(NodeId);
            return treeNodes;
        }
        /// <summary>
        /// 插入动态表信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task CreateAnalysisTable(AnalysisTableInforDto input)
        {
            var analysisTableInfor = ObjectMapper.Map<AnalysisTableInfor>(input);
            await _analysisTableInfor.InsertAsync(analysisTableInfor);
        }
        /// <summary>
        /// 根据Name查询表信息
        /// </summary>
        /// <param name="name">表名称</param>
        ///  <param name="showSequence">默认为0全表查询为1是包络选需要表名名称</param>
        /// <returns></returns>
        public List<AnalysisTableInforDto> GetAnalysisTableList(string name, int showSequence = 0)
        {
            if (string.IsNullOrEmpty(name))
            {
                if (showSequence == 1)
                {
                    return ObjectMapper.Map<List<AnalysisTableInforDto>>(_analysisTableInfor.GetAll().Where(d => d.ShowSequence == 1));
                }
                else
                {
                    return ObjectMapper.Map<List<AnalysisTableInforDto>>(_analysisTableInfor.GetAll().OrderBy(d => d.ShowSequence));
                }
            }
            var analysisList = ObjectMapper.Map<List<AnalysisTableInforDto>>(_analysisTableInfor.GetAll().Where(d => d.TableName.Contains(name)).Where(d => d.ShowSequence == showSequence));

            return analysisList;
        }
        /// <summary>
        /// 获取已经入库的关联表名
        /// </summary>
        /// <param name="model">型号</param>
        /// <param name="lotstr">发次</param>
        /// <param name="nodeId">nodeId</param>
        /// <param name="nodeLevel">层级  8工序 9 工步</param>
        /// <param name="ShowAll">展示全部</param>
        /// <returns></returns>
        public List<string> GetHeaderList(string model, string lotstr, Guid? nodeId, int nodeLevel, bool ShowAll, List<string> lotstrList = null)
        {
            List<string> fileNameList = new List<string>();
            fileNameList.AddRange(new string[] { "装入件明细", "制造资源", "视频" });
            List<RbopDesc> bopDescList = new List<RbopDesc>();
            if (lotstrList.Count == 0)
            {
                bopDescList = _rBopDescRepository.GetAll().Where(d => d.Model == model && d.LotNo == lotstr).ToList();
                if (bopDescList.Count > 1)
                {
                    throw new UserFriendlyException("查询多个匹配该型号与发次的火箭！");
                }
            }
            else
            {
                lotstrList.Add(lotstr);
                bopDescList = _rBopDescRepository.GetAll().Where(d => d.Model == model && lotstrList.Contains(d.LotNo)).ToList();
            }


            List<Guid> workStepList = new List<Guid>();
            if (ShowAll || lotstrList.Count > 0)
            {
                var techIds = (from cc in _rBopNodeRepository.GetAll()
                               join pp in bopDescList on cc.RbopDescId equals pp.Id
                               where cc.RtechniqueEntityId != null
                               select cc.RtechniqueEntityId);

                if (techIds.Count() > 0)
                {
                    var workIds = (from cc in _rworkStepEntity.GetAll()
                                   join mm in techIds on cc.RTechniqueEntityId equals mm
                                   select cc.Id);
                    if (workIds.Count() > 0)
                    {
                        workStepList.AddRange(workIds);
                    }
                }
            }
            else if (nodeLevel == 8) //8工序
            {
                workStepList = _rworkStepEntity.GetAll().Where(d => d.RProcessesEntityId == nodeId).Select(d => d.Id).ToList();
            }
            else if (nodeLevel == 9)// 9工步其他都是节点
            {
                workStepList.Add(new Guid(nodeId.Value.ToString()));
            }
            else
            {
                var query = _rBopNodeRepository.FirstOrDefault(d => d.Id == nodeId.Value);
                if (query != null)
                {
                    var techIds = _rBopNodeRepository.GetAll().Where(d => d.NodeCode.StartsWith(query.NodeCode) && d.RbopDescId == bopDescList.First().Id).Where(d => d.RtechniqueEntityId != null).Select(d => d.RtechniqueEntityId).ToList();
                    if (techIds.Count() > 0)
                    {
                        var workIds = (from cc in _rworkStepEntity.GetAll()
                                       join mm in techIds on cc.RTechniqueEntityId equals mm
                                       select cc.Id);
                        if (workIds.Count() > 0)
                        {
                            workStepList.AddRange(workIds);
                        }
                    }
                }
            }
            var nameList = (from cc in _rTableBaseEntity.GetAll()
                            join mm in workStepList on cc.RWorkStepEntityId equals mm
                            select cc.FormName).ToList();
            if (nameList.Count > 0)
            {
                fileNameList.AddRange(nameList.Distinct());
            }
            return fileNameList;
        }
        /// <summary>
        /// 工艺工程规程文件首页
        /// </summary>
        /// <param name="id">节点Id</param>
        /// <returns></returns>
        public async Task<RTechFileHeaderDto> GetTechFileHeader(Guid id)
        {
            //根据节点Id去查询绑定的文档
            var datalist = new RTechFileHeaderDto();
            var bopNode = await _rBopNodeRepository.FirstOrDefaultAsync(x => x.Id == id);
            if (bopNode == null) return new RTechFileHeaderDto();
            var tech = _rtechniqueEntity.FirstOrDefaultAsync(x => x.TechniqueEntityId == bopNode.TechniqueEntityId).Result;
            if (tech != null)
            {
                datalist = ObjectMapper.Map<RTechFileHeaderDto>(tech);
            }
            return datalist;
        }

        /// <summary>
        /// 质量中台解析工步下的所有记录表
        /// </summary>
        /// <param name="workStep">要导出的工步Dto</param>
        /// <param name="RtableNameDictionary">返回给前端的表头字典</param>
        private void RworkStepJsonAnalysis(RworkStepOutDto workStep, List<RtableNameDictionary> RtableNameDictionary)
        {
            RtableNameDictionary.Clear();
            Dictionary<string, FiledMap> filedMap = new Dictionary<string, FiledMap>();
            InitFiledMap(filedMap);
            var operationName = _rtechniqueEntity.GetAll().Where(d => d.Id == workStep.RTechniqueEntityId).First().TechniqueNumber;
            var InsertDetailsEntitys = _rLoadPieceRepository.GetAll().Where(p => p.RWorkStepEntityId == workStep.Id).OrderBy(n => n.Index);
            if (InsertDetailsEntitys.Count() > 0)
            {
                workStep.InsertDetails = ObjectMapper.Map<List<RInsertDetailsDto>>(InsertDetailsEntitys.OrderBy(n => n.Index));
                if (workStep.InsertDetails.Count > 0)
                {
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "insertDetails";
                    table.TableName = "装入件明细";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = workStep.InsertDetails.First().Sort;
                    RtableNameDictionary.Add(table);

                }
            }

            //制造资源
            var ManufacturingResourcesEntitys = _rMakeResourcesEntityRepository.GetAll().Where(p => p.RWorkStepEntityId == workStep.Id).OrderBy(n => n.Index).ToList();
            if (ManufacturingResourcesEntitys.Count() > 0)
            {
                workStep.ManufacturingResources = ObjectMapper.Map<List<RManufacturingResourcesDto>>(ManufacturingResourcesEntitys.OrderBy(n => n.Index));
                if (workStep.ManufacturingResources.Count > 0)
                {
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "manufacturingResources";
                    table.TableName = "制造资源";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = workStep.ManufacturingResources.First().Sort;
                    RtableNameDictionary.Add(table);

                }
            }

            //视频
            var videoEntityEntitys = _rVideoEntityRepository.GetAll().Where(p => p.RWorkStepEntityId == workStep.Id);
            if (videoEntityEntitys.Count() > 0)
            {
                workStep.Video = ObjectMapper.Map<List<RVideoFrequencyDto>>(videoEntityEntitys.OrderBy(n => n.Index));
                if (workStep.Video.Count > 0)
                {
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "video";
                    table.TableName = "视频";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = workStep.Video.First().Sort;
                    RtableNameDictionary.Add(table);
                }
            }

            var tableData = _rTableBaseEntity.GetAllIncluding(a => a.RecordRequirements, b => b.InspectionSignature, c => c.MeasuredResult, d => d.Environment, e => e.MultiMedia).Where(d => d.RWorkStepEntityId == workStep.Id);
            var tableNameArry = tableData.Select(d => d.FormName).Distinct().ToArray();
            if (tableNameArry.Contains("通用总装数据记录表"))
            {
                var query = tableData.Where(d => d.FormName == "通用总装数据记录表");
                var data = (ObjectMapper.Map<List<RassembleDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.Assemble = data.ToList();
                    //签署数据过滤 FirstOperator 存入的是json串 数据 user:XX time：xxx : image：xxx 然后 图片处理成 http 仅此而已
                    workStep.Assemble.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "assemble";
                    table.TableName = "通用总装数据记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.Assemble = new List<RassembleDto>();
                }
            }
            if (tableNameArry.Contains("通用记录表"))
            {
                var query = tableData.Where(d => d.FormName == "通用记录表");
                var data = (ObjectMapper.Map<List<RgeneralRecordsDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.GeneralRecords = data.ToList();
                    workStep.GeneralRecords.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "generalRecords";
                    table.TableName = "通用记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;

                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.GeneralRecords = new List<RgeneralRecordsDto>();
                }
            }
            if (tableNameArry.Contains("胶液配比情况记录表"))
            {
                var query = tableData.Where(d => d.FormName == "胶液配比情况记录表");
                var data = (ObjectMapper.Map<List<RglueSolutionDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.GlueSolution = data.ToList();
                    workStep.GlueSolution.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "glueSolution";
                    table.TableName = "胶液配比情况记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.GlueSolution = new List<RglueSolutionDto>();
                }
            }
            if (tableNameArry.Contains("舱口盖开闭记录表"))
            {
                var query = tableData.Where(d => d.FormName == "舱口盖开闭记录表");
                var data = (ObjectMapper.Map<List<RhatchOpenShutDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.Hatch = data.ToList();
                    workStep.Hatch.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "hatch";
                    table.TableName = "舱口盖开闭记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.Hatch = new List<RhatchOpenShutDto>();
                }
            }
            if (tableNameArry.Contains("进箱舱登记表"))
            {
                var query = tableData.Where(d => d.FormName == "进箱舱登记表");
                var data = (ObjectMapper.Map<List<RinCabinDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.InCabin = data.ToList();
                    workStep.InCabin.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "inCabin";
                    table.TableName = "进箱（舱）登记表";
                    table.FiledDesc = filedMap["进箱舱登记表"].filedValue;
                    table.FiledName = filedMap["进箱舱登记表"].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.InCabin = new List<RinCabinDto>();
                }
            }
            if (tableNameArry.Contains("具有证明书的主要零件记录表"))
            {
                var query = tableData.Where(d => d.FormName == "具有证明书的主要零件记录表");
                var data = (ObjectMapper.Map<List<RmainPartsDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.MainParts = data.ToList();
                    workStep.MainParts.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "mainParts";
                    table.TableName = "具有证明书的主要零件记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.MainParts = new List<RmainPartsDto>();
                }
            }
            if (tableNameArry.Contains("力矩记录表"))
            {
                var query = tableData.Where(d => d.FormName == "力矩记录表");
                var data = (ObjectMapper.Map<List<RmomentRecordingDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.Moment = data.ToList();
                    workStep.Moment.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "moment";
                    table.TableName = "力矩记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.Moment = new List<RmomentRecordingDto>();
                }
            }
            if (tableNameArry.Contains("通用多媒体记录表"))
            {
                var query = tableData.Where(d => d.FormName == "通用多媒体记录表");
                var data = (ObjectMapper.Map<List<RmultimediaRecordDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.MultimediaRecord = data.ToList();
                    workStep.MultimediaRecord.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "multimediaRecord";
                    table.TableName = "通用多媒体记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.MultimediaRecord = new List<RmultimediaRecordDto>();
                }
            }
            if (tableNameArry.Contains("通用力矩复校记录表"))
            {
                var query = tableData.Where(d => d.FormName == "通用力矩复校记录表");
                var data = (ObjectMapper.Map<List<RtorqueReCalibrationDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.TorqueReCalibration = data.ToList();
                    workStep.TorqueReCalibration.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "torqueReCalibration";
                    table.TableName = "通用力矩复校记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.TorqueReCalibration = new List<RtorqueReCalibrationDto>();
                }
            }
            if (tableNameArry.Contains("质量控制记录表"))
            {
                var query = tableData.Where(d => d.FormName == "质量控制记录表");
                var data = (ObjectMapper.Map<List<RqualityControlDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.QualityControl = data.ToList();
                    workStep.QualityControl.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                        //d.FourthOperator = GetAnalysisOperator(d.FourthOperator, operationName);
                        //d.FifthOperator = GetAnalysisOperator(d.FifthOperator, operationName);
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "qualityControl";
                    table.TableName = "质量控制记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.QualityControl = new List<RqualityControlDto>();
                }
            }
            if (tableNameArry.Contains("电缆插头防水防热记录表"))
            {
                var query = tableData.Where(d => d.FormName == "电缆插头防水防热记录表");
                var data = (ObjectMapper.Map<List<RcablePlugWaterFireProofDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.CablePlugWaterFireProofControl = data.ToList();
                    workStep.CablePlugWaterFireProofControl.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "cablePlugWaterFireProofControl";
                    table.TableName = "电缆（插头）防水（防热）记录表";
                    table.FiledDesc = filedMap["电缆插头防水防热记录表"].filedValue;
                    table.FiledName = filedMap["电缆插头防水防热记录表"].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.CablePlugWaterFireProofControl = new List<RcablePlugWaterFireProofDto>();
                }
            }
            if (tableNameArry.Contains("波纹管变形记录表"))
            {
                var query = tableData.Where(d => d.FormName == "波纹管变形记录表");
                var data = (ObjectMapper.Map<List<RbellowsDeformationDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.BellowsDeformation = data.ToList();
                    workStep.BellowsDeformation.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "bellowsDeformation";
                    table.TableName = "波纹管变形记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.BellowsDeformation = new List<RbellowsDeformationDto>();
                }
            }
            if (tableNameArry.Contains("电连接器插接记录表"))
            {
                var query = tableData.Where(d => d.FormName == "电连接器插接记录表");
                var data = (ObjectMapper.Map<List<RelectricalConnectInsertionDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ElectricalConnectInsertion = data.ToList();
                    workStep.ElectricalConnectInsertion.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        d.SecondPhotoNo = GetPictureRoute(d.SecondPhotoNo, operationName, 0);
                        d.ThirdPhotoNo = GetPictureRoute(d.ThirdPhotoNo, operationName, 0);
                        d.FourthPhotoNo = GetPictureRoute(d.FourthPhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                            d.FourthOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                            d.FourthOperator = GetAnalysisOperator(d.FourthOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "electricalConnectInsertion";
                    table.TableName = "电连接器插接记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ElectricalConnectInsertion = new List<RelectricalConnectInsertionDto>();
                }
            }
            if (tableNameArry.Contains("舱口盖开闭测试记录表"))
            {
                var query = tableData.Where(d => d.FormName == "舱口盖开闭测试记录表");
                var data = (ObjectMapper.Map<List<RHatchOpenShutTestDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.HatchOpenShutTest = data.ToList();
                    workStep.HatchOpenShutTest.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "hatchOpenShutTest";
                    table.TableName = "舱口盖开闭测试记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.HatchOpenShutTest = new List<RHatchOpenShutTestDto>();
                }
            }
            if (tableNameArry.Contains("产品接地状态检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "产品接地状态检查记录表");
                var data = (ObjectMapper.Map<List<RProductGroundingStatusDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ProductGroundingStatus = data.ToList();
                    workStep.ProductGroundingStatus.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "productGroundingStatus";
                    table.TableName = "产品接地状态检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ProductGroundingStatus = new List<RProductGroundingStatusDto>();
                }
            }
            if (tableNameArry.Contains("强制检验点记录表"))
            {
                var query = tableData.Where(d => d.FormName == "强制检验点记录表");
                var data = (ObjectMapper.Map<List<RForcedCheckpointDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ForcedCheckpoint = data.ToList();
                    workStep.ForcedCheckpoint.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                            d.FourthOperator = "不需要";
                            d.FifthOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                            d.FourthOperator = GetAnalysisOperator(d.FourthOperator, operationName);
                            d.FifthOperator = GetAnalysisOperator(d.FifthOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "forcedCheckpoint";
                    table.TableName = "强制检验点记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ForcedCheckpoint = new List<RForcedCheckpointDto>();
                }
            }
            if (tableNameArry.Contains("自动关闭口盖检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "自动关闭口盖检查记录表");
                var data = (ObjectMapper.Map<List<RAutomaticShutoffDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.AutomaticShutoff = data.ToList();
                    workStep.AutomaticShutoff.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "automaticShutoff";
                    table.TableName = "自动关闭口盖检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.AutomaticShutoff = new List<RAutomaticShutoffDto>();
                }
            }
            if (tableNameArry.Contains("伺服机构工艺拉杆长度记录表"))
            {
                var query = tableData.Where(d => d.FormName == "伺服机构工艺拉杆长度记录表");
                var data = (ObjectMapper.Map<List<RServomechanismDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.Servomechanism = data.ToList();
                    workStep.Servomechanism.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "servomechanism";
                    table.TableName = "伺服机构工艺拉杆长度记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.Servomechanism = new List<RServomechanismDto>();
                }
            }
            if (tableNameArry.Contains("状态检查表"))
            {
                var query = tableData.Where(d => d.FormName == "状态检查表");
                var data = (ObjectMapper.Map<List<RStatusCheckDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.StatusCheck = data.ToList();
                    workStep.StatusCheck.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "statusCheck";
                    table.TableName = "状态检查表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.StatusCheck = new List<RStatusCheckDto>();
                }
            }
            if (tableNameArry.Contains("问题记录表"))
            {
                var query = tableData.Where(d => d.FormName == "问题记录表");
                var data = (ObjectMapper.Map<List<RProblemRecordDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ProblemRecord = data.ToList();
                    workStep.ProblemRecord.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "problemRecord";
                    table.TableName = "问题记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ProblemRecord = new List<RProblemRecordDto>();
                }
            }
            if (tableNameArry.Contains("爆索尺寸测量记录表"))
            {
                var query = tableData.Where(d => d.FormName == "爆索尺寸测量记录表");
                var data = (ObjectMapper.Map<List<RDetonatingCableSizeDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.DetonatingCableSize = data.ToList();
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "detonatingCableSize";
                    table.TableName = "爆索尺寸测量记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.DetonatingCableSize = new List<RDetonatingCableSizeDto>();
                }
            }
            if (tableNameArry.Contains("整流罩星箭分离弹簧压缩数据记录表"))
            {
                var query = tableData.Where(d => d.FormName == "整流罩星箭分离弹簧压缩数据记录表");
                var data = (ObjectMapper.Map<List<RReleaseSpringCompressionDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ReleaseSpringCompression = data.ToList();
                    workStep.ReleaseSpringCompression.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }

                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "releaseSpringCompression";
                    table.TableName = "整流罩/星箭分离弹簧压缩数据记录表";
                    table.FiledDesc = filedMap["整流罩星箭分离弹簧压缩数据记录表"].filedValue;
                    table.FiledName = filedMap["整流罩星箭分离弹簧压缩数据记录表"].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ReleaseSpringCompression = new List<RReleaseSpringCompressionDto>();
                }
            }
            if (tableNameArry.Contains("载荷支架组合体形位数据记录表"))
            {
                var query = tableData.Where(d => d.FormName == "载荷支架组合体形位数据记录表");
                var data = (ObjectMapper.Map<List<RLoadBracketDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.LoadBracket = data.ToList();
                    workStep.LoadBracket.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "loadBracket";
                    table.TableName = "载荷支架组合体形位数据记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.LoadBracket = new List<RLoadBracketDto>();
                }
            }
            if (tableNameArry.Contains("设计签署总装数据记录表"))
            {
                var query = tableData.Where(d => d.FormName == "设计签署总装数据记录表");
                var data = (ObjectMapper.Map<List<RDesignGeneralAssembleDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.DesignGeneralAssemble = data.ToList();
                    workStep.DesignGeneralAssemble.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                            d.FourthOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                            d.FourthOperator = GetAnalysisOperator(d.FourthOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "designGeneralAssemble";
                    table.TableName = "设计签署总装数据记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.DesignGeneralAssemble = new List<RDesignGeneralAssembleDto>();
                }
            }
            if (tableNameArry.Contains("管路活门气密点检查记录表皂泡法"))
            {
                var query = tableData.Where(d => d.FormName == "管路活门气密点检查记录表皂泡法");
                var data = (ObjectMapper.Map<List<RSoapBubbleDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.SoapBubble = data.ToList();

                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "soapBubble";
                    table.TableName = "管路活门气密点检查记录表皂泡法";
                    table.FiledDesc = filedMap["管路活门气密点检查记录表皂泡法"].filedValue;
                    table.FiledName = filedMap["管路活门气密点检查记录表皂泡法"].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.SoapBubble = new List<RSoapBubbleDto>();
                }
            }
            if (tableNameArry.Contains("管路活门气密点检查记录表氦质谱法"))
            {
                var query = tableData.Where(d => d.FormName == "管路活门气密点检查记录表氦质谱法");
                var data = (ObjectMapper.Map<List<RHeliumMassSpectrometryDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.HeliumMassSpectrometry = data.ToList();
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "heliumMassSpectrometry";
                    table.TableName = "管路活门气密点检查记录表氦质谱法";
                    table.FiledDesc = filedMap["管路活门气密点检查记录表氦质谱法"].filedValue;
                    table.FiledName = filedMap["管路活门气密点检查记录表氦质谱法"].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.HeliumMassSpectrometry = new List<RHeliumMassSpectrometryDto>();
                }
            }
            if (tableNameArry.Contains("除了打保险防松外的总装直属件记录表"))
            {
                var query = tableData.Where(d => d.FormName == "除了打保险防松外的总装直属件记录表");
                var data = (ObjectMapper.Map<List<RFinalAssemblyPartsDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.FinalAssemblyParts = data.ToList();
                    workStep.FinalAssemblyParts.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "finalAssemblyParts";
                    table.TableName = "除了打保险防松外的总装直属件记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.FinalAssemblyParts = new List<RFinalAssemblyPartsDto>();
                }
            }
            if (tableNameArry.Contains("传感器安装测试记录情况统计记录表"))
            {
                var query = tableData.Where(d => d.FormName == "传感器安装测试记录情况统计记录表").OrderBy(t => t.Sort);
                var data = (ObjectMapper.Map<List<RSensorInstallationDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.SensorInstallation = data.ToList();
                    workStep.SensorInstallation.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "sensorInstallation";
                    table.TableName = "传感器安装测试记录情况统计记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.SensorInstallation = new List<RSensorInstallationDto>();
                }
            }
            if (tableNameArry.Contains("插头状态检查表"))
            {
                var query = tableData.Where(d => d.FormName == "插头状态检查表");
                var data = (ObjectMapper.Map<List<RPlugStatusDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.PlugStatus = data.ToList();
                    workStep.PlugStatus.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "plugStatus";
                    table.TableName = "插头状态检查表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.PlugStatus = new List<RPlugStatusDto>();
                }
            }
            if (tableNameArry.Contains("惯组安装记录表一"))
            {
                var query = tableData.Where(d => d.FormName == "惯组安装记录表一");
                var data = (ObjectMapper.Map<List<RFirstIMUInstallationDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.FirstIMUInstallation = data.ToList();
                    workStep.FirstIMUInstallation.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "firstIMUInstallation";
                    table.TableName = "惯组安装记录表一";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.FirstIMUInstallation = new List<RFirstIMUInstallationDto>();
                }
            }
            if (tableNameArry.Contains("惯组安装记录表二"))
            {
                var query = tableData.Where(d => d.FormName == "惯组安装记录表二");
                var data = (ObjectMapper.Map<List<RSecondIMUInstallationDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.SecondIMUInstallation = data.ToList();
                    workStep.SecondIMUInstallation.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "secondIMUInstallation";
                    table.TableName = "惯组安装记录表二";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.SecondIMUInstallation = new List<RSecondIMUInstallationDto>();
                }
            }
            if (tableNameArry.Contains("电缆高度测量记录表"))
            {
                var query = tableData.Where(d => d.FormName == "电缆高度测量记录表");
                var data = (ObjectMapper.Map<List<RCableHeightDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.CableHeight = data.ToList();
                    workStep.CableHeight.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "cableHeight";
                    table.TableName = "电缆高度测量记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.CableHeight = new List<RCableHeightDto>();
                }
            }
            if (tableNameArry.Contains("压接实验测量记录表低频"))
            {
                var query = tableData.Where(d => d.FormName == "压接实验测量记录表低频");
                var data = (ObjectMapper.Map<List<RLowCrimpingExperimentDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.LowCrimpingExperiment = data.ToList();
                    workStep.LowCrimpingExperiment.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "lowCrimpingExperiment";
                    table.TableName = "压接实验测量记录表低频";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.LowCrimpingExperiment = new List<RLowCrimpingExperimentDto>();
                }
            }
            if (tableNameArry.Contains("电缆剥线试验记录表低频"))
            {
                var query = tableData.Where(d => d.FormName == "电缆剥线试验记录表低频");
                var data = (ObjectMapper.Map<List<RLowFrequencyCableStrippingDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.LowFrequencyCableStripping = data.ToList();
                    workStep.LowFrequencyCableStripping.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }

                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "lowFrequencyCableStripping";
                    table.TableName = "电缆剥线试验记录表(低频)";
                    table.FiledDesc = filedMap["电缆剥线试验记录表低频"].filedValue;
                    table.FiledName = filedMap["电缆剥线试验记录表低频"].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.LowFrequencyCableStripping = new List<RLowFrequencyCableStrippingDto>();
                }
            }
            if (tableNameArry.Contains("电缆剥线试验记录表高频"))
            {
                var query = tableData.Where(d => d.FormName == "电缆剥线试验记录表高频");
                var data = (ObjectMapper.Map<List<RHighFrequencyCableStrippingDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.HighFrequencyCableStripping = data.ToList();
                    workStep.HighFrequencyCableStripping.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                        }

                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "highFrequencyCableStripping";
                    table.TableName = "电缆剥线试验记录表(高频)";
                    table.FiledDesc = filedMap["电缆剥线试验记录表高频"].filedValue;
                    table.FiledName = filedMap["电缆剥线试验记录表高频"].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.HighFrequencyCableStripping = new List<RHighFrequencyCableStrippingDto>();
                }
            }
            if (tableNameArry.Contains("仪器接收检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "仪器接收检查记录表");
                var data = (ObjectMapper.Map<List<RInstrumentCheckDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.InstrumentCheck = data.ToList();
                    workStep.InstrumentCheck.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "instrumentCheck";
                    table.TableName = "仪器接收检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.InstrumentCheck = new List<RInstrumentCheckDto>();
                }
            }
            if (tableNameArry.Contains("电缆接收检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "电缆接收检查记录表");
                var data = (ObjectMapper.Map<List<RCableReceivingInspectionDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.CableReceivingInspection = data.ToList();
                    workStep.CableReceivingInspection.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "cableReceivingInspection";
                    table.TableName = "电缆接收检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.CableReceivingInspection = new List<RCableReceivingInspectionDto>();
                }
            }
            if (tableNameArry.Contains("箭地接口保护件检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "箭地接口保护件检查记录表");
                var data = (ObjectMapper.Map<List<RArrowInterfaceProtectCheckDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ArrowInterfaceProtectCheck = data.ToList();
                    workStep.ArrowInterfaceProtectCheck.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "arrowInterfaceProtectCheck";
                    table.TableName = "箭地接口保护件检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ArrowInterfaceProtectCheck = new List<RArrowInterfaceProtectCheckDto>();
                }
            }
            if (tableNameArry.Contains("通用检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "通用检查记录表");
                var data = (ObjectMapper.Map<List<RInspectionRecordDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.InspectionRecord = data.ToList();
                    workStep.InspectionRecord.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "inspectionRecord";
                    table.TableName = "通用检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.InspectionRecord = new List<RInspectionRecordDto>();
                }
            }
            if (tableNameArry.Contains("对接面形位记录表"))
            {
                var query = tableData.Where(d => d.FormName == "对接面形位记录表");
                var data = (ObjectMapper.Map<List<RDockSurfaceMorphemeDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.DockSurfaceMorpheme = data.ToList();
                    workStep.DockSurfaceMorpheme.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "dockSurfaceMorpheme";
                    table.TableName = "对接面形位记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.DockSurfaceMorpheme = new List<RDockSurfaceMorphemeDto>();
                }
            }
            if (tableNameArry.Contains("整流罩锉修记录表"))
            {
                var query = tableData.Where(d => d.FormName == "整流罩锉修记录表");
                var data = (ObjectMapper.Map<List<RFilingFileRepairDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.FilingFileRepair = data.ToList();
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "filingFileRepair";
                    table.TableName = "整流罩锉修记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.FilingFileRepair = new List<RFilingFileRepairDto>();
                }
            }
            if (tableNameArry.Contains("整流罩安装后检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "整流罩安装后检查记录表");
                var data = (ObjectMapper.Map<List<RCheckFairingAfterInstallationDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.CheckFairingAfterInstallation = data.ToList();
                    workStep.CheckFairingAfterInstallation.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "checkFairingAfterInstallation";
                    table.TableName = "整流罩安装后检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.CheckFairingAfterInstallation = new List<RCheckFairingAfterInstallationDto>();
                }
            }
            if (tableNameArry.Contains("导管检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "导管检查记录表");
                var data = (ObjectMapper.Map<List<RcatheterizationDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.Catheterization = data.ToList();
                    workStep.Catheterization.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                            d.FourthOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                            d.FourthOperator = GetAnalysisOperator(d.FourthOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "catheterization";
                    table.TableName = "导管检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.Catheterization = new List<RcatheterizationDto>();
                }
            }
            if (tableNameArry.Contains("管路上箭前吹除记录表"))
            {
                var query = tableData.Where(d => d.FormName == "管路上箭前吹除记录表");
                var data = (ObjectMapper.Map<List<RblowPipeArrowDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.BlowPipeArrow = data.ToList();
                    workStep.BlowPipeArrow.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "blowPipeArrow";
                    table.TableName = "管路上箭前吹除记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.BlowPipeArrow = new List<RblowPipeArrowDto>();
                }
            }
            if (tableNameArry.Contains("气封管流量测试记录表"))
            {
                var query = tableData.Where(d => d.FormName == "气封管流量测试记录表");
                var data = (ObjectMapper.Map<List<RgasPipeTestDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.GasPipeTest = data.ToList();
                    workStep.GasPipeTest.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "gasPipeTest";
                    table.TableName = "气封管流量测试记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.GasPipeTest = new List<RgasPipeTestDto>();
                }
            }
            if (tableNameArry.Contains("阀门气瓶过滤器流量计输送管金属软管等检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "阀门气瓶过滤器流量计输送管金属软管等检查记录表");
                var data = (ObjectMapper.Map<List<RvalvesGasInspectionDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ValvesGasInspection = data.ToList();
                    workStep.ValvesGasInspection.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "valvesGasInspection";
                    table.TableName = "阀门、气瓶、过滤器、流量计、输送管、金属软管等检查记录表";
                    table.FiledDesc = filedMap["阀门气瓶过滤器流量计输送管金属软管等检查记录表"].filedValue;
                    table.FiledName = filedMap["阀门气瓶过滤器流量计输送管金属软管等检查记录表"].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ValvesGasInspection = new List<RvalvesGasInspectionDto>();
                }
            }
            if (tableNameArry.Contains("单机安装位置记录表"))
            {
                var query = tableData.Where(d => d.FormName == "单机安装位置记录表");
                var data = (ObjectMapper.Map<List<RinstallationLocationDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.InstallationLocation = data.ToList();
                    workStep.InstallationLocation.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "installationLocation";
                    table.TableName = "单机安装位置记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.InstallationLocation = new List<RinstallationLocationDto>();
                }
            }
            if (tableNameArry.Contains("安装距离记录表"))
            {
                var query = tableData.Where(d => d.FormName == "安装距离记录表");
                var data = (ObjectMapper.Map<List<RinstallationDistanceDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.InstallationDistance = data.ToList();
                    workStep.InstallationDistance.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "installationDistance";
                    table.TableName = "安装距离记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.InstallationDistance = new List<RinstallationDistanceDto>();
                }
            }
            if (tableNameArry.Contains("小导管卡箍间距测量表"))
            {
                var query = tableData.Where(d => d.FormName == "小导管卡箍间距测量表");
                var data = (ObjectMapper.Map<List<RmeasurementSpacingConduitDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.MeasurementSpacingConduit = data.ToList();
                    workStep.MeasurementSpacingConduit.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "measurementSpacingConduit";
                    table.TableName = "小导管卡箍间距测量表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.MeasurementSpacingConduit = new List<RmeasurementSpacingConduitDto>();
                }
            }
            if (tableNameArry.Contains("未按要求施加力矩及未打保险防松记录表"))
            {
                var query = tableData.Where(d => d.FormName == "未按要求施加力矩及未打保险防松记录表");
                var data = (ObjectMapper.Map<List<RfailureAequiredLoosInsuranceDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.FailureAequiredLoosInsurance = data.ToList();
                    workStep.FailureAequiredLoosInsurance.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "failureAequiredLoosInsurance";
                    table.TableName = "未按要求施加力矩及未打保险防松记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.FailureAequiredLoosInsurance = new List<RfailureAequiredLoosInsuranceDto>();
                }
            }
            if (tableNameArry.Contains("分解重装记录表"))
            {
                var query = tableData.Where(d => d.FormName == "分解重装记录表");
                var data = (ObjectMapper.Map<List<RdisassemblyReassemblyDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.DisassemblyReassembly = data.ToList();
                    workStep.DisassemblyReassembly.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "disassemblyReassembly";
                    table.TableName = "分解重装记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.DisassemblyReassembly = new List<RdisassemblyReassemblyDto>();
                }
            }
            if (tableNameArry.Contains("配合七零三绝热记录表"))
            {
                var query = tableData.Where(d => d.FormName == "配合七零三绝热记录表");
                var data = (ObjectMapper.Map<List<Rinsulation703Dto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.Insulation703 = data.ToList();
                    workStep.Insulation703.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "insulation703";
                    table.TableName = "配合七零三绝热记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.Insulation703 = new List<Rinsulation703Dto>();
                }
            }
            if (tableNameArry.Contains("绝热去除记录表"))
            {
                var query = tableData.Where(d => d.FormName == "绝热去除记录表");
                var data = (ObjectMapper.Map<List<RadiabaticRemovalDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.AdiabaticRemoval = data.ToList();
                    workStep.AdiabaticRemoval.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "adiabaticRemoval";
                    table.TableName = "绝热去除记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.AdiabaticRemoval = new List<RadiabaticRemovalDto>();
                }
            }
            if (tableNameArry.Contains("连续拧紧环节力矩复校记录表"))
            {
                var query = tableData.Where(d => d.FormName == "连续拧紧环节力矩复校记录表");
                var data = (ObjectMapper.Map<List<RcalibrationContinuousTorqueDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.CalibrationContinuousTorque = data.ToList();
                    workStep.CalibrationContinuousTorque.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "calibrationContinuousTorque";
                    table.TableName = "连续拧紧环节力矩复校记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.CalibrationContinuousTorque = new List<RcalibrationContinuousTorqueDto>();
                }
            }
            if (tableNameArry.Contains("管路垫块安装情况记录表"))
            {
                var query = tableData.Where(d => d.FormName == "管路垫块安装情况记录表");
                var data = (ObjectMapper.Map<List<RinstallationPipeCushionDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.InstallationPipeCushion = data.ToList();
                    workStep.InstallationPipeCushion.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "installationPipeCushion";
                    table.TableName = "管路垫块安装情况记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.InstallationPipeCushion = new List<RinstallationPipeCushionDto>();
                }
            }
            if (tableNameArry.Contains("箭体结构防水记录表"))
            {
                var query = tableData.Where(d => d.FormName == "箭体结构防水记录表");
                var data = (ObjectMapper.Map<List<RarrowStructureWaterproofDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ArrowStructureWaterproof = data.ToList();
                    workStep.ArrowStructureWaterproof.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "arrowStructureWaterproof";
                    table.TableName = "箭体结构防水记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ArrowStructureWaterproof = new List<RarrowStructureWaterproofDto>();
                }
            }
            if (tableNameArry.Contains("搭接线安装部位防水记录表"))
            {
                var query = tableData.Where(d => d.FormName == "搭接线安装部位防水记录表");
                var data = (ObjectMapper.Map<List<RwaterproofInstallationLapdDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.WaterproofInstallationLapd = data.ToList();
                    workStep.WaterproofInstallationLapd.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "waterproofInstallationLapd";
                    table.TableName = "搭接线安装部位防水记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.WaterproofInstallationLapd = new List<RwaterproofInstallationLapdDto>();
                }
            }
            if (tableNameArry.Contains("箭体称重时多装少装产品记录表"))
            {
                var query = tableData.Where(d => d.FormName == "箭体称重时多装少装产品记录表");
                var data = (ObjectMapper.Map<List<RarrowScalageProductsDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ArrowScalageProducts = data.ToList();
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "arrowScalageProducts";
                    table.TableName = "箭体称重时多装少装产品记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ArrowScalageProducts = new List<RarrowScalageProductsDto>();
                }
            }
            if (tableNameArry.Contains("箭体称重记录表"))
            {
                var query = tableData.Where(d => d.FormName == "箭体称重记录表");
                var data = (ObjectMapper.Map<List<RarrowWeightDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ArrowWeight = data.ToList();
                    workStep.ArrowWeight.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "arrowWeight";
                    table.TableName = "箭体称重记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ArrowWeight = new List<RarrowWeightDto>();
                }
            }
            if (tableNameArry.Contains("总装零件称重记录表"))
            {
                var query = tableData.Where(d => d.FormName == "总装零件称重记录表");
                var data = (ObjectMapper.Map<List<RassemnleweighingDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.Assemnleweighing = data.ToList();
                    workStep.Assemnleweighing.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "assemnleweighing";
                    table.TableName = "总装零件称重记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.Assemnleweighing = new List<RassemnleweighingDto>();
                }
            }
            if (tableNameArry.Contains("阀门安装状态确认表"))
            {
                var query = tableData.Where(d => d.FormName == "阀门安装状态确认表");
                var data = (ObjectMapper.Map<List<RconfirmationStatusDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ConfirmationStatus = data.ToList();
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "confirmationStatus";
                    table.TableName = "阀门安装状态确认表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ConfirmationStatus = new List<RconfirmationStatusDto>();
                }
            }
            if (tableNameArry.Contains("传感器变换器对应关系确认记录表"))
            {
                var query = tableData.Where(d => d.FormName == "传感器变换器对应关系确认记录表");
                var data = (ObjectMapper.Map<List<RcorrespondingRelationshipDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.CorrespondingRelationship = data.ToList();
                    workStep.CorrespondingRelationship.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "correspondingRelationship";
                    table.TableName = "传感器变换器对应关系确认记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.CorrespondingRelationship = new List<RcorrespondingRelationshipDto>();
                }
            }
            if (tableNameArry.Contains("密封插头压接多媒体记录表"))
            {
                var query = tableData.Where(d => d.FormName == "密封插头压接多媒体记录表");
                var data = (ObjectMapper.Map<List<RcrimpingSealedPlugDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.CrimpingSealedPlug = data.ToList();
                    workStep.CrimpingSealedPlug.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                            d.FourthOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                            d.FourthOperator = GetAnalysisOperator(d.FourthOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "crimpingSealedPlug";
                    table.TableName = "密封插头压接多媒体记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.CrimpingSealedPlug = new List<RcrimpingSealedPlugDto>();
                }
            }
            if (tableNameArry.Contains("气瓶组充放气速率记录表"))
            {
                var query = tableData.Where(d => d.FormName == "气瓶组充放气速率记录表");
                var data = (ObjectMapper.Map<List<RcylinderGroupDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.CylinderGroup = data.ToList();
                    workStep.CylinderGroup.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "cylinderGroup";
                    table.TableName = "气瓶组充放气速率记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.CylinderGroup = new List<RcylinderGroupDto>();
                }
            }
            if (tableNameArry.Contains("气瓶压力测试记录表"))
            {
                var query = tableData.Where(d => d.FormName == "气瓶压力测试记录表");
                var data = (ObjectMapper.Map<List<RcylinderPressureTestDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.CylinderPressureTest = data.ToList();
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "cylinderPressureTest";
                    table.TableName = "气瓶压力测试记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.CylinderPressureTest = new List<RcylinderPressureTestDto>();
                }
            }
            if (tableNameArry.Contains("干燥剂检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "干燥剂检查记录表");
                var data = (ObjectMapper.Map<List<RdesiccantInspectionDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.DesiccantInspection = data.ToList();
                    workStep.DesiccantInspection.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "desiccantInspection";
                    table.TableName = "干燥剂检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.DesiccantInspection = new List<RdesiccantInspectionDto>();
                }
            }
            if (tableNameArry.Contains("低频压接实验测量记录表"))
            {
                var query = tableData.Where(d => d.FormName == "低频压接实验测量记录表");
                var data = (ObjectMapper.Map<List<RexperimentalCrimpingDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ExperimentalCrimping = data.ToList();
                    workStep.ExperimentalCrimping.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "experimentalCrimping";
                    table.TableName = "低频压接实验测量记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ExperimentalCrimping = new List<RexperimentalCrimpingDto>();
                }
            }
            if (tableNameArry.Contains("飞行质量质心皮重及参数记录表"))
            {
                var query = tableData.Where(d => d.FormName == "飞行质量质心皮重及参数记录表");
                var data = (ObjectMapper.Map<List<RflightMassCentroidTareWeightDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.FlightMassCentroidTareWeight = data.ToList();
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "flightMassCentroidTareWeight";
                    table.TableName = "飞行质量质心皮重及参数记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.FlightMassCentroidTareWeight = new List<RflightMassCentroidTareWeightDto>();
                }
            }
            if (tableNameArry.Contains("气封流量测试记录表"))
            {
                var query = tableData.Where(d => d.FormName == "气封流量测试记录表");
                var data = (ObjectMapper.Map<List<RgasSealFlowTestDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.GasSealFlowTest = data.ToList();
                    workStep.GasSealFlowTest.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "gasSealFlowTest";
                    table.TableName = "气封流量测试记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.GasSealFlowTest = new List<RgasSealFlowTestDto>();
                }
            }
            if (tableNameArry.Contains("总装耗材称重记录表"))
            {
                var query = tableData.Where(d => d.FormName == "总装耗材称重记录表");
                var data = (ObjectMapper.Map<List<RgeneralWeighingDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.GeneralWeighing = data.ToList();
                    workStep.GeneralWeighing.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "generalWeighing";
                    table.TableName = "总装耗材称重记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.GeneralWeighing = new List<RgeneralWeighingDto>();
                }
            }
            if (tableNameArry.Contains("高频压接点电阻及抗电强度检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "高频压接点电阻及抗电强度检查记录表");
                var data = (ObjectMapper.Map<List<RhighFrequencyVoltageDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.HighFrequencyVoltage = data.ToList();
                    workStep.HighFrequencyVoltage.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "highFrequencyVoltage";
                    table.TableName = "高频压接点电阻及抗电强度检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.HighFrequencyVoltage = new List<RhighFrequencyVoltageDto>();
                }
            }
            if (tableNameArry.Contains("产品安装数量记录表"))
            {
                var query = tableData.Where(d => d.FormName == "产品安装数量记录表");
                var data = (ObjectMapper.Map<List<RinstallationQuantityDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.InstallationQuantity = data.ToList();
                    workStep.InstallationQuantity.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "installationQuantity";
                    table.TableName = "产品安装数量记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.InstallationQuantity = new List<RinstallationQuantityDto>();
                }
            }
            if (tableNameArry.Contains("接口检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "接口检查记录表");
                var data = (ObjectMapper.Map<List<RinterfaceCheckDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.InterfaceCheck = data.ToList();
                    workStep.InterfaceCheck.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "interfaceCheck";
                    table.TableName = "接口检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.InterfaceCheck = new List<RinterfaceCheckDto>();
                }
            }
            if (tableNameArry.Contains("岗位分工表"))
            {
                var query = tableData.Where(d => d.FormName == "岗位分工表");
                var data = (ObjectMapper.Map<List<RjobDivisionDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.JobDivision = data.ToList();
                    workStep.JobDivision.ForEach(d =>
                    {
                        d.FirstMeasuredValues = GetAnalysisMeasuredValuesOperator(d.FirstMeasuredValues);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                            d.FourthOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                            d.FourthOperator = GetAnalysisOperator(d.FourthOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "jobDivision";
                    table.TableName = "岗位分工表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.JobDivision = new List<RjobDivisionDto>();
                }
            }
            if (tableNameArry.Contains("随大部段交付产品明细表"))
            {
                var query = tableData.Where(d => d.FormName == "随大部段交付产品明细表");
                var data = (ObjectMapper.Map<List<RlargePartsDeliveryDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.LargePartsDelivery = data.ToList();
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "largePartsDelivery";
                    table.TableName = "随大部段交付产品明细表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.LargePartsDelivery = new List<RlargePartsDeliveryDto>();
                }
            }
            if (tableNameArry.Contains("飞行质量质心设备调平数据记录表"))
            {
                var query = tableData.Where(d => d.FormName == "飞行质量质心设备调平数据记录表");
                var data = (ObjectMapper.Map<List<RlevelingDataFlightDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.LevelingDataFlight = data.ToList();
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "levelingDataFlight";
                    table.TableName = "飞行质量质心设备调平数据记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.LevelingDataFlight = new List<RlevelingDataFlightDto>();
                }
            }
            if (tableNameArry.Contains("液位传感器尺寸协调记录表"))
            {
                var query = tableData.Where(d => d.FormName == "液位传感器尺寸协调记录表");
                var data = (ObjectMapper.Map<List<RliquidLevelSensorDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.LiquidLevelSensor = data.ToList();
                    workStep.LiquidLevelSensor.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "liquidLevelSensor";
                    table.TableName = "液位传感器尺寸协调记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.LiquidLevelSensor = new List<RliquidLevelSensorDto>();
                }
            }
            if (tableNameArry.Contains("产品安装确认表"))
            {
                var query = tableData.Where(d => d.FormName == "产品安装确认表");
                var data = (ObjectMapper.Map<List<RproductInstallationConfirmationDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ProductInstallationConfirmation = data.ToList();
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "productInstallationConfirmation";
                    table.TableName = "产品安装确认表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ProductInstallationConfirmation = new List<RproductInstallationConfirmationDto>();
                }
            }
            if (tableNameArry.Contains("通用保护件检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "通用保护件检查记录表");
                var data = (ObjectMapper.Map<List<RprotectivePartsDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ProtectiveParts = data.ToList();
                    workStep.ProtectiveParts.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "protectiveParts";
                    table.TableName = "通用保护件检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ProtectiveParts = new List<RprotectivePartsDto>();
                }
            }
            if (tableNameArry.Contains("象限标识检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "象限标识检查记录表");
                var data = (ObjectMapper.Map<List<RquadrantCheckDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.QuadrantCheck = data.ToList();
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "quadrantCheck";
                    table.TableName = "象限标识检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.QuadrantCheck = new List<RquadrantCheckDto>();
                }
            }
            if (tableNameArry.Contains("通用接收检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "通用接收检查记录表");
                var data = (ObjectMapper.Map<List<RreceivingInspectionRecordDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ReceivingInspectionRecord = data.ToList();
                    workStep.ReceivingInspectionRecord.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "receivingInspectionRecord";
                    table.TableName = "通用接收检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ReceivingInspectionRecord = new List<RreceivingInspectionRecordDto>();
                }
            }
            if (tableNameArry.Contains("系统保压记录表"))
            {
                var query = tableData.Where(d => d.FormName == "系统保压记录表");
                var data = (ObjectMapper.Map<List<RsystemPressureMaintainingDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.SystemPressureMaintaining = data.ToList();
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "systemPressureMaintaining";
                    table.TableName = "系统保压记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.SystemPressureMaintaining = new List<RsystemPressureMaintainingDto>();
                }
            }
            if (tableNameArry.Contains("电磁阀尾罩检查表"))
            {
                var query = tableData.Where(d => d.FormName == "电磁阀尾罩检查表");
                var data = (ObjectMapper.Map<List<RtailCoverSolenoidDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.TailCoverSolenoid = data.ToList();
                    workStep.TailCoverSolenoid.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "tailCoverSolenoid";
                    table.TableName = "电磁阀尾罩检查表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.TailCoverSolenoid = new List<RtailCoverSolenoidDto>();
                }
            }
            if (tableNameArry.Contains("高频压接点抗拉强度检查记录表"))
            {
                var query = tableData.Where(d => d.FormName == "高频压接点抗拉强度检查记录表");
                var data = (ObjectMapper.Map<List<RtensileStrengthHighDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.TensileStrengthHigh = data.ToList();
                    workStep.TensileStrengthHigh.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "tensileStrengthHigh";
                    table.TableName = "高频压接点抗拉强度检查记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.TensileStrengthHigh = new List<RtensileStrengthHighDto>();
                }
            }
            if (tableNameArry.Contains("横向质心测量记录表"))
            {
                var query = tableData.Where(d => d.FormName == "横向质心测量记录表");
                var data = (ObjectMapper.Map<List<RtransverseCentroidDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.TransverseCentroid = data.ToList();
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "transverseCentroid";
                    table.TableName = "横向质心测量记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.TransverseCentroid = new List<RtransverseCentroidDto>();
                }
            }
            if (tableNameArry.Contains("阀门测试记录表一"))
            {
                var query = tableData.Where(d => d.FormName == "阀门测试记录表一");
                var data = (ObjectMapper.Map<List<RvalveTestDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ValveTest = data.ToList();
                    workStep.ValveTest.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "valveTest";
                    table.TableName = "阀门测试记录表一";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ValveTest = new List<RvalveTestDto>();
                }
            }
            if (tableNameArry.Contains("阀门测试记录表二"))
            {
                var query = tableData.Where(d => d.FormName == "阀门测试记录表二");
                var data = (ObjectMapper.Map<List<RvalveTestSecDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ValveTestSec = data.ToList();
                    workStep.ValveTestSec.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "valveTestSec";
                    table.TableName = "阀门测试记录表二";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ValveTestSec = new List<RvalveTestSecDto>();
                }
            }
            if (tableNameArry.Contains("阀门使用次数记录表"))
            {
                var query = tableData.Where(d => d.FormName == "阀门使用次数记录表");
                var data = (ObjectMapper.Map<List<RvalveUsageTimesDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.ValveUsageTimes = data.ToList();
                    workStep.ValveUsageTimes.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "valveUsageTimes";
                    table.TableName = "阀门使用次数记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.ValveUsageTimes = new List<RvalveUsageTimesDto>();
                }
            }
            if (tableNameArry.Contains("大部段称重记录表"))
            {
                var query = tableData.Where(d => d.FormName == "大部段称重记录表");
                var data = (ObjectMapper.Map<List<RlargeSectionWeightDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.LargeSectionWeight = data.ToList();
                    workStep.LargeSectionWeight.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "largeSectionWeight ";
                    table.TableName = "大部段称重记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    table.Sort = data.First().Sort;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.LargeSectionWeight = new List<RlargeSectionWeightDto>();
                }
            }
            if (tableNameArry.Contains("电连接器插接多媒体记录表"))
            {
                var query = tableData.Where(d => d.FormName == "电连接器插接多媒体记录表");
                var data = (ObjectMapper.Map<List<RmultimediaElectricalConnectDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.MultimediaElectricalConnect = data.ToList();
                    workStep.MultimediaElectricalConnect.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        d.SecondPhotoNo = GetPictureRoute(d.SecondPhotoNo, operationName, 0);
                        d.ThirdPhotoNo = GetPictureRoute(d.ThirdPhotoNo, operationName, 0);
                        d.FourthPhotoNo = GetPictureRoute(d.FourthPhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "multimediaElectricalConnect";
                    table.TableName = "电连接器插接多媒体记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.MultimediaElectricalConnect = new List<RmultimediaElectricalConnectDto>();
                }
            }
            if (tableNameArry.Contains("仪器安装电缆余量多媒体记录表"))
            {
                var query = tableData.Where(d => d.FormName == "仪器安装电缆余量多媒体记录表");
                var data = (ObjectMapper.Map<List<RinstrumentCableAllowanceDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.InstrumentCableAllowance = data.ToList();
                    workStep.InstrumentCableAllowance.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "instrumentCableAllowance";
                    table.TableName = "仪器安装电缆余量多媒体记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.InstrumentCableAllowance = new List<RinstrumentCableAllowanceDto>();
                }
            }
            if (tableNameArry.Contains("仪器安装分离钢索多媒体记录表"))
            {
                var query = tableData.Where(d => d.FormName == "仪器安装分离钢索多媒体记录表");
                var data = (ObjectMapper.Map<List<RinstrumentSeparationCableDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.InstrumentSeparationCable = data.ToList();
                    workStep.InstrumentSeparationCable.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "instrumentSeparationCable";
                    table.TableName = "仪器安装分离钢索多媒体记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.InstrumentSeparationCable = new List<RinstrumentSeparationCableDto>();
                }
            }
            if (tableNameArry.Contains("仪器安装分离力测试多媒体记录表"))
            {
                var query = tableData.Where(d => d.FormName == "仪器安装分离力测试多媒体记录表");
                var data = (ObjectMapper.Map<List<RinstrumentSeparationForceTestDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.InstrumentSeparationForceTest = data.ToList();
                    workStep.InstrumentSeparationForceTest.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "instrumentSeparationForceTest";
                    table.TableName = "仪器安装分离力测试多媒体记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.InstrumentSeparationForceTest = new List<RinstrumentSeparationForceTestDto>();
                }
            }
            if (tableNameArry.Contains("仪器安装力矩记录表"))
            {
                var query = tableData.Where(d => d.FormName == "仪器安装力矩记录表");
                var data = (ObjectMapper.Map<List<RinstrumentTorqueRecordDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.InstrumentTorqueRecord = data.ToList();
                    workStep.InstrumentTorqueRecord.ForEach(d =>
                    {
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "instrumentTorqueRecord";
                    table.TableName = "仪器安装力矩记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.InstrumentTorqueRecord = new List<RinstrumentTorqueRecordDto>();
                }
            }
            if (tableNameArry.Contains("仪器插座安装多媒体记录表"))
            {
                var query = tableData.Where(d => d.FormName == "仪器插座安装多媒体记录表");
                var data = (ObjectMapper.Map<List<RmultimediaSheetSocketDto>>(query)).OrderBy(d => d.SerialNum);
                if (data.Count() > 0)
                {
                    workStep.MultimediaSheetSocket = data.ToList();
                    workStep.MultimediaSheetSocket.ForEach(d =>
                    {
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, operationName, 0);
                        if (d.InspectionSignatureName == null)
                        {
                            d.FirstOperator = "不需要";
                            d.SecondOperator = "不需要";
                            d.ThirdOperator = "不需要";
                        }
                        else
                        {
                            d.FirstOperator = GetAnalysisOperator(d.FirstOperator, operationName);
                            d.SecondOperator = GetAnalysisOperator(d.SecondOperator, operationName);
                            d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, operationName);
                        }
                    });
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "multimediaSheetSocket";
                    table.TableName = "仪器插座安装多媒体记录表";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    RtableNameDictionary.Add(table);
                }
                else
                {
                    workStep.MultimediaSheetSocket = new List<RmultimediaSheetSocketDto>();
                }
            }
        }
        /// <summary>
        /// 根据工步Id获取关联相关表
        /// </summary>
        /// <param name="workStepId">工步Id</param>
        /// <returns></returns>
        public PQualitWorkStepDto GetWorkStepOut(Guid workStepId)
        {
            if (string.IsNullOrEmpty(workStepId.ToString()))
            {
                throw new UserFriendlyException("节点不可为空!");
            }
            var workStep = _rworkStepEntity.GetAll().Where(d => d.Id == workStepId).FirstOrDefault();
            if (workStep != null)
            {
                var code = "";
                if (workStep.RTechniqueEntityId != null)
                {
                    var tech = _rtechniqueEntity.FirstOrDefault(workStep.RTechniqueEntityId);
                    if (tech != null)
                    {
                        code = tech.TechniqueNumber;
                    }
                }
                RworkStepOutDto workDto = new RworkStepOutDto();
                workDto.Id = workStepId;
                workDto.RTechniqueEntityId = workStep.RTechniqueEntityId;
                workDto.RProcessesEntityId = workStep.RProcessesEntityId;
                workDto.WorkStepEntityId = workStep.WorkStepEntityId;
                workDto.WorkStepNumber = workStep.WorkStepNumber;
                workDto.WorkStepName = workStep.WorkStepName;
                workDto.WorkStepCharacteristic = workStep.WorkStepCharacteristic;
                string url = ConfigHelper.GetAppSetting("App", "GetAppUrl");
                if (workStep.WorkStepContent != null)
                {
                    workDto.WorkStepContent = workStep.WorkStepContent.Replace("src=\"", "src=\"" + url + @"/UploadFile/" + code + @"/");

                }
                workDto.WorkStepWorking = workStep.WorkStepWorking;
                List<RtableNameDictionary> tableNameDictionary = new List<RtableNameDictionary>();
                RworkStepJsonAnalysis(workDto, tableNameDictionary);
                PQualitWorkStepDto workStepAndProcessDto = ObjectMapper.Map<PQualitWorkStepDto>(_rprocessesEntity.Get(workDto.RProcessesEntityId));
                tableNameDictionary = tableNameDictionary.OrderBy(d => d.Sort).ToList();
                workStepAndProcessDto.WorkStepOut = workDto;
                workStepAndProcessDto.TableNameDictionary = tableNameDictionary;
                return workStepAndProcessDto;
            }
            else
            {
                throw new UserFriendlyException("系统无法查找该对象!");
            }

        }

        /// <summary>
        /// 质量中台 根据processId获取工序
        /// </summary>
        /// <param name="processId"></param>
        /// <returns></returns>
        public RprocessesDto GetRprocessesById(Guid processId)
        {
            var tempPro = ObjectMapper.Map<RprocessesDto>(_rprocessesEntity.Get(processId));
            var code = "";
            if (tempPro.RTechniqueEntityId != null)
            {
                var tech = _rtechniqueEntity.FirstOrDefault(tempPro.RTechniqueEntityId);
                if (tech != null)
                {
                    code = tech.TechniqueNumber;
                }
            }
            string url = ConfigHelper.GetAppSetting("App", "GetAppUrl");
            if (tempPro.ProcessesExplain != null)
            {
                //tempPro.ProcessesExplain = tempPro.ProcessesExplain.Replace("../", url + @"/");
                tempPro.ProcessesExplain = tempPro.ProcessesExplain.Replace("src=\"", "src=\"" + url + @"/UploadFile/" + code + @"/");
            }
            return tempPro;
        }

        /// <summary>
        /// 型号的模糊查询
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public List<string> GetModelNameList(string model)
        {
            var result = (from cc in _rBopDescRepository.GetAll()
                          where cc.Status == Status.已导出
                          select cc.Model);

            if (result.Count() > 0)
            {
                return result.Distinct().WhereIf(!string.IsNullOrEmpty(model), d => d.Contains(model)).ToList();
            }
            else
            {
                return null;
            }

        }

        /// <summary>
        /// 发次的模糊查询（基于型号查询数据）
        /// </summary>
        /// <param name="lotstr"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public List<string> GetLotNoList(string lotstr, string model)
        {
            var result = (from cc in _rBopDescRepository.GetAll()
                          where cc.Status == Status.已导出
                          select new
                          {
                              Model = cc.Model,
                              LotNo = cc.LotNo
                          });

            if (result.Count() > 0)
            {
                var query = result.WhereIf(!string.IsNullOrEmpty(model), d => d.Model.Contains(model)).WhereIf(!string.IsNullOrEmpty(lotstr), d => d.Model.Contains(lotstr));
                if (query.Count() > 0)
                {
                    return query.Select(d => d.LotNo).Distinct().ToList();
                }
                else
                {
                    return null;
                }
            }
            else
            {
                return null;
            }

        }
        /// <summary>
        /// 质量Bop Tree（自建节点，带根节点信息）
        /// </summary>
        /// <param name="lotstr"></param>
        /// <param name="model"></param>
        /// <returns></returns>
        public RbopModelDto GetTreeContainRoot(string lotstr, string model)
        {
            RbopModelDto rbopModelDto = new RbopModelDto();
            RnodeDescDto parentNode = new RnodeDescDto();
            var query = _rBopDescRepository.GetAll();
            //if (model != null)
            //{
            //    query = query.Where(d => d.ModelId == model);
            //}
            //if (lotstr != null)
            //{
            //    query = query.Where(d => d.LotNoId == lotstr);
            //}

            if (!string.IsNullOrEmpty(model))
            {
                query = query.Where(d => d.Model == model);
            }
            if (!string.IsNullOrEmpty(lotstr))
            {
                query = query.Where(d => d.LotNo == lotstr);
            }
            if (query.Count() > 0)
            {
                parentNode = ObjectMapper.Map<RnodeDescDto>(query.First());
                rbopModelDto.ParentNode = parentNode;
                treeNodes.Clear();
                BindTree(null, parentNode.Id);
                rbopModelDto.ChildNodes = treeNodes;
            }
            return rbopModelDto;
        }
        /// <summary>
        /// 统计照片和视频数量
        /// </summary>
        /// <param name="model"></param>
        /// <param name="lotstr"></param>
        /// <param name="nodeId"></param>
        /// <param name="tableNameStr"></param>
        /// <param name="FisrtDrawingNum"></param>
        /// <param name="FirstDrawingName"></param>
        /// <param name="SecondDrawingNum"></param>
        /// <param name="SecondDrawingName"></param>
        /// <param name="ToolUsed"></param>
        /// <param name="RecordElementStr"></param>
        /// <param name="ShowAll"></param>
        /// <param name="nodeLevel"></param>
        /// <param name="lotstrList"></param>
        /// <returns></returns>
        public PicturesAndVideoNumsDto GetPictureAndVideoNums(string model, string lotstr, Guid? nodeId, string tableNameStr, string FisrtDrawingNum, string FirstDrawingName, string SecondDrawingNum, string SecondDrawingName, string ToolUsed, string RecordElementStr, bool ShowAll, int nodeLevel, List<string> lotstrList = null)
        {
            PicturesAndVideoNumsDto picturesAndVideoNums = new PicturesAndVideoNumsDto();
            string[] tableNames;
            if (string.IsNullOrEmpty(tableNameStr))
            {
                tableNames = GetAnalysisTableList("").Select(d => d.TableName).ToArray();
            }
            else
            {
                tableNames = tableNameStr.Split(",").ToArray();
            }
            List<RbopDesc> bopDescList = new List<RbopDesc>();
            if (lotstrList.Count == 0)
            {
                bopDescList = _rBopDescRepository.GetAll().Where(d => d.Model == model && d.LotNo == lotstr).ToList();
                if (bopDescList.Count > 1)
                {
                    throw new UserFriendlyException("查询多个匹配该型号与发次的火箭！");
                }
            }
            else
            {
                lotstrList.Add(lotstr);
                bopDescList = _rBopDescRepository.GetAll().Where(d => d.Model == model && lotstrList.Contains(d.LotNo)).ToList();
            }
            List<Guid> workStepList = new List<Guid>();
            if (ShowAll || lotstrList.Count > 0)
            {
                var techIds = (from cc in _rBopNodeRepository.GetAll()
                               join pp in bopDescList on cc.RbopDescId equals pp.Id
                               join tt in _rtechniqueEntity.GetAll().Where(s => s.ReturnStatus != "报废") on cc.RtechniqueEntityId equals tt.Id
                               where cc.RtechniqueEntityId != null
                               select cc.RtechniqueEntityId);
                if (techIds.Count() > 0)
                {
                    var workIds = (from cc in _rworkStepEntity.GetAll()
                                   join mm in techIds on cc.RTechniqueEntityId equals mm
                                   select cc.Id);
                    if (workIds.Count() > 0)
                    {
                        workStepList.AddRange(workIds);
                    }
                }
            }
            else if (nodeLevel == 8) //8工序
            {
                var returnStatus = (from tt in _rtechniqueEntity.GetAll()
                                    join ww in _rprocessesEntity.GetAll().Where(d => d.Id == nodeId)
                                    on tt.Id equals ww.RTechniqueEntityId
                                    select tt.ReturnStatus).ToString();
                if (returnStatus == "报废")
                {
                    throw new UserFriendlyException("该工艺规程已经报废");
                }
                workStepList = _rworkStepEntity.GetAll().Where(d => d.RProcessesEntityId == nodeId).Select(d => d.Id).ToList();
            }
            else if (nodeLevel == 9)// 9工步其他都是节点
            {
                var returnStatus = (from tt in _rtechniqueEntity.GetAll()
                                    join ww in _rworkStepEntity.GetAll().Where(d => d.Id == nodeId)
                                    on tt.Id equals ww.RTechniqueEntityId
                                    select tt.ReturnStatus).ToString();
                if (returnStatus == "报废")
                {
                    throw new UserFriendlyException("该工艺规程已经报废");
                }
                workStepList.Add(new Guid(nodeId.Value.ToString()));
            }
            else
            {

                var query = _rBopNodeRepository.FirstOrDefault(d => d.Id == nodeId.Value);
                if (query != null)
                {
                    var techIds = (from bb in _rBopNodeRepository.GetAll().Where(d => d.NodeCode.StartsWith(query.NodeCode) && d.RbopDescId == bopDescList.First().Id).Where(d => d.RtechniqueEntityId != null)
                                   join tt in _rtechniqueEntity.GetAll().Where(s => s.ReturnStatus != "报废") on bb.RtechniqueEntityId equals tt.Id
                                   select bb.RtechniqueEntityId).ToList();
                    if (techIds.Count() > 0)
                    {
                        var workIds = (from cc in _rworkStepEntity.GetAll()
                                       join mm in techIds on cc.RTechniqueEntityId equals mm
                                       select cc.Id);
                        if (workIds.Count() > 0)
                        {
                            workStepList.AddRange(workIds);
                        }
                    }
                }
            }
            if (workStepList.Count > 0)
            {
                var routeDic = from work in _rworkStepEntity.GetAll()
                               join process in _rprocessesEntity.GetAll() on work.RProcessesEntityId equals process.Id
                               join tech in _rtechniqueEntity.GetAll() on work.RTechniqueEntityId equals tech.Id
                               where workStepList.Contains(work.Id)
                               select new RouteDic
                               {
                                   RWorkStepEntityId = work.Id,
                                   Route = tech.ModuleName + "-" + "工步" + process.ProcessesSequence + "-" + work.WorkStepNumber,
                                   OperationName = tech.TechniqueNumber,
                                   LotNo = tech.LotNo,
                               };
                Dictionary<Guid, string> mapRoute = new Dictionary<Guid, string>();
                Dictionary<Guid, string> mapOperationName = new Dictionary<Guid, string>();
                Dictionary<Guid, string> mapLotNo = new Dictionary<Guid, string>();
            }
            var tableData = (from cc in _rTableBaseEntity.GetAllIncluding(a => a.RecordRequirements, b => b.InspectionSignature, c => c.MeasuredResult, d => d.Environment, e => e.MultiMedia)
                             join mm in workStepList on cc.RWorkStepEntityId equals mm
                             join pp in tableNames on cc.FormName equals pp
                             select cc);
            //筛选条件
            if (!string.IsNullOrEmpty(FisrtDrawingNum))
            {
                tableData = tableData.Where(d => d.FisrtDrawingNum.Contains(FisrtDrawingNum));
            }
            if (!string.IsNullOrEmpty(FirstDrawingName))
            {
                tableData = tableData.Where(d => d.FirstDrawingName.Contains(FirstDrawingName));
            }
            if (!string.IsNullOrEmpty(SecondDrawingNum))
            {
                tableData = tableData.Where(d => d.SecondDrawingNum.Contains(SecondDrawingNum));
            }
            if (!string.IsNullOrEmpty(SecondDrawingName))
            {
                tableData = tableData.Where(d => d.SecondDrawingName.Contains(SecondDrawingName));
            }
            if (!string.IsNullOrEmpty(ToolUsed))
            {
                tableData = tableData.Where(d => d.ToolUsed.Contains(ToolUsed));
            }
            if (!string.IsNullOrEmpty(RecordElementStr))
            {
                tableData = tableData.Where(d => d.RecordElement.Contains(RecordElementStr));
            }
            if (tableData.Count() > 0)
            {
                int pictureNum = 0;
                int videoNum = 0;
                Regex rege = new Regex(".jpg", RegexOptions.Compiled);
                Regex regev = new Regex(".mp4", RegexOptions.Compiled);
                var str = "";
                foreach (var item in tableData)
                {
                    if (item.InspectionSignature != null)
                    {
                        if (!string.IsNullOrEmpty(item.InspectionSignature.FirstOperator))
                        {
                            str = item.InspectionSignature.FirstOperator.Replace(".png", ".jpg").Replace(".jpeg", ".jpg");
                            pictureNum += rege.Matches(str).Count;
                        }
                        if (!string.IsNullOrEmpty(item.InspectionSignature.SecondOperator))
                        {
                            str = item.InspectionSignature.SecondOperator.Replace(".png", ".jpg").Replace(".jpeg", ".jpg");
                            pictureNum += rege.Matches(str).Count;
                        }
                        if (!string.IsNullOrEmpty(item.InspectionSignature.ThirdOperator))
                        {
                            str = item.InspectionSignature.ThirdOperator.Replace(".png", ".jpg").Replace(".jpeg", ".jpg");
                            pictureNum += rege.Matches(str).Count;
                        }
                        if (!string.IsNullOrEmpty(item.InspectionSignature.FourthOperator))
                        {
                            str = item.InspectionSignature.FourthOperator.Replace(".png", ".jpg").Replace(".jpeg", ".jpg");
                            pictureNum += rege.Matches(str).Count;
                        }
                        if (!string.IsNullOrEmpty(item.InspectionSignature.FifthOperator))
                        {
                            str = item.InspectionSignature.FifthOperator.Replace(".png", ".jpg").Replace(".jpeg", ".jpg");
                            pictureNum += rege.Matches(str).Count;
                        }
                    }
                    if (item.MultiMedia != null)
                    {
                        if (!string.IsNullOrEmpty(item.MultiMedia.PhotoNo))
                        {
                            str = item.MultiMedia.PhotoNo.Replace(".png", ".jpg").Replace(".jpeg", ".jpg");
                            pictureNum += rege.Matches(str).Count;
                            videoNum += regev.Matches(item.MultiMedia.PhotoNo).Count;
                        }
                        if (!string.IsNullOrEmpty(item.MultiMedia.SecondPhotoNo))
                        {
                            str = item.MultiMedia.SecondPhotoNo.Replace(".png", ".jpg").Replace(".jpeg", ".jpg");
                            pictureNum += rege.Matches(str).Count;
                            videoNum += regev.Matches(item.MultiMedia.SecondPhotoNo).Count;
                        }
                        if (!string.IsNullOrEmpty(item.MultiMedia.ThirdPhotoNo))
                        {
                            str = item.MultiMedia.ThirdPhotoNo.Replace(".png", ".jpg").Replace(".jpeg", ".jpg");
                            pictureNum += rege.Matches(str).Count;
                            videoNum += regev.Matches(item.MultiMedia.ThirdPhotoNo).Count;
                        }
                    }
                }
                picturesAndVideoNums.PictureNum = pictureNum;
                picturesAndVideoNums.VideoNum = videoNum;
            }
            return picturesAndVideoNums;
        }
        /// <summary>
        /// 汇总统计 --数据附带路径信息route   --多媒体调用接口  tableNameStr写死为 “多媒体表”
        /// </summary>
        /// <param name="model">型号</param>
        /// <param name="lotstr">发次</param>
        /// <param name="nodeId">节点Id</param>
        /// <param name="tableNameStr">多表名称 以逗号隔开</param>
        /// <param name="FisrtDrawingNum">图号/代号</param>
        /// <param name="FirstDrawingName">图号名称</param>
        /// <param name="SecondDrawingNum">零件2代号</param>
        /// <param name="SecondDrawingName">零件2名称</param>
        /// <param name="ToolUsed">所用工具编号</param>
        /// <param name="RecordElementStr">记录项目</param>
        /// <param name="ShowAll">node节点是否为空 true则 无需选中节点</param>
        /// <param name="DisplayRoute">是否显示路径 true显示 </param>
        /// <param name="nodeLevel">节点层级 默认是节点 8为工序 9 为工步</param>
        /// <param name="reachTable">刷新分页的当前表名</param>
        /// <param name="envelope">是否包络，true 包络</param>
        /// <param name="pageIndex">查询的页数 </param>
        /// <param name="pageSize">每页显示的个数</param>
        /// <param name="paging">是否开启分页 默认为true分页,false不开启分页</param>
        /// <param name="isExport">是否是excel导出 默认为false（不是），ture（是excel导出，视频和图片地址去掉前后拼接地址）</param>
        /// <returns></returns>
        public PQualitWorkStepDto StatisticalReport(string model, string lotstr, Guid? nodeId, string tableNameStr, string FisrtDrawingNum, string FirstDrawingName, string SecondDrawingNum, string SecondDrawingName, string ToolUsed, string RecordElementStr, bool ShowAll, bool DisplayRoute, int nodeLevel, string reachTable = "", bool envelope = false, int pageIndex = 1, int pageSize = 10, bool paging = true, List<string> lotstrList = null, bool isExcel = false, bool isExport = false, bool isFt = false)
        {
            //根据一大堆检索条件 然后获取某一树节点的 综合查询 表格记录 

            // 分页 就是展示 不分页 就是导出 。。
            PQualitWorkStepDto workStepAndProcessDto = new PQualitWorkStepDto();
            RworkStepOutDto rworkStepOutDto = new RworkStepOutDto();
            List<RtableNameDictionary> tableNameDictionary = new List<RtableNameDictionary>();
            Dictionary<string, FiledMap> filedMap = new Dictionary<string, FiledMap>();
            InitFiledMap(filedMap);
            string[] tableNames;
            //Dictionary <Guid,string>
            if (string.IsNullOrEmpty(tableNameStr))
            {
                tableNames = GetAnalysisTableList("").Select(d => d.TableName).ToArray();
            }
            else
            {
                tableNames = tableNameStr.Split(",").ToArray();
            }
            List<RbopDesc> bopDescList = new List<RbopDesc>();

            if (lotstrList.Count == 0)
            {
                bopDescList = _rBopDescRepository.GetAll().Where(d => d.Model == model && d.LotNo == lotstr).ToList();
                if (bopDescList.Count > 1)
                {
                    throw new UserFriendlyException("查询多个匹配该型号与发次的火箭！");
                }
            }
            else
            {
                lotstrList.Add(lotstr);
                bopDescList = _rBopDescRepository.GetAll().Where(d => d.Model == model && lotstrList.Contains(d.LotNo)).ToList();
            }

            List<Guid> workStepList = new List<Guid>();
            //var techniqueQuery = _rtechniqueEntity.GetAll();
            //if (!string.IsNullOrEmpty(lotstr))
            //{
            //    var lotstrArry = lotstr.Split(",").ToArray();
            //    techniqueQuery = techniqueQuery.Where(d => lotstrArry.Contains(d.LotNo));
            //}
            //if (!string.IsNullOrEmpty(model))
            //{
            //    techniqueQuery = techniqueQuery.Where(d => d.Model.Contains(model));
            //}
            if (ShowAll || lotstrList.Count > 0)
            {
                var techIds = (from cc in _rBopNodeRepository.GetAll()
                               join pp in bopDescList on cc.RbopDescId equals pp.Id
                               join tt in _rtechniqueEntity.GetAll().Where(s => s.ReturnStatus != "报废") on cc.RtechniqueEntityId equals tt.Id
                               where cc.RtechniqueEntityId != null
                               select cc.RtechniqueEntityId);
                if (techIds.Count() > 0)
                {
                    var workIds = (from cc in _rworkStepEntity.GetAll()
                                   join mm in techIds on cc.RTechniqueEntityId equals mm
                                   select cc.Id);
                    if (workIds.Count() > 0)
                    {
                        workStepList.AddRange(workIds);
                    }
                }
                //var realIds = techniqueQuery.Select(d => d.Id);
                //var processesQuery = _rprocessesEntity.GetAllIncluding(p => p.WorkStepEntities).Where(d => realIds.Contains(d.RTechniqueEntityId)).OrderBy(n => n.ProcessesSequence);
                //foreach (var item in processesQuery)
                //{
                //    workStepList.AddRange(item.WorkStepEntities.OrderBy(d => d.WorkStepNumber).Select(d => d.Id));
                //}
                //workStepList = workStepList.Distinct().ToList();
            }
            else if (nodeLevel == 8) //8工序
            {
                var returnStatus = (from tt in _rtechniqueEntity.GetAll()
                                    join ww in _rprocessesEntity.GetAll().Where(d => d.Id == nodeId)
                                    on tt.Id equals ww.RTechniqueEntityId
                                    select tt.ReturnStatus).ToString();
                if (returnStatus == "报废")
                {
                    throw new UserFriendlyException("该工艺规程已经报废");
                }
                workStepList = _rworkStepEntity.GetAll().Where(d => d.RProcessesEntityId == nodeId).Select(d => d.Id).ToList();
            }
            else if (nodeLevel == 9)// 9工步其他都是节点
            {
                var returnStatus = (from tt in _rtechniqueEntity.GetAll()
                                    join ww in _rworkStepEntity.GetAll().Where(d => d.Id == nodeId)
                                    on tt.Id equals ww.RTechniqueEntityId
                                    select tt.ReturnStatus).ToString();
                if (returnStatus == "报废")
                {
                    throw new UserFriendlyException("该工艺规程已经报废");
                }
                workStepList.Add(new Guid(nodeId.Value.ToString()));
            }
            else
            {

                var query = _rBopNodeRepository.FirstOrDefault(d => d.Id == nodeId.Value);
                if (query != null)
                {
                    var techIds = (from bb in _rBopNodeRepository.GetAll().Where(d => d.NodeCode.StartsWith(query.NodeCode) && d.RbopDescId == bopDescList.First().Id).Where(d => d.RtechniqueEntityId != null)
                                   join tt in _rtechniqueEntity.GetAll().Where(s => s.ReturnStatus != "报废") on bb.RtechniqueEntityId equals tt.Id
                                   select bb.RtechniqueEntityId).ToList();
                    if (techIds.Count() > 0)
                    {
                        var workIds = (from cc in _rworkStepEntity.GetAll()
                                       join mm in techIds on cc.RTechniqueEntityId equals mm
                                       select cc.Id);
                        if (workIds.Count() > 0)
                        {
                            workStepList.AddRange(workIds);
                        }
                    }
                }
                //var query = _rBopNodeRepository.GetAll().Where(d => d.Id == nodeId);
                //if (query.Count() > 0 && techniqueQuery.Count() > 0)
                //{
                //    string code = query.Select(d => d.NodeCode).Distinct().ToList().First();
                //    var codeList = _rBopNodeRepository.GetAll().Where(d => d.NodeCode.StartsWith(code)); //向下查找
                //    //筛选符合条件的工艺Id集合
                //    var techniqueIds = codeList.Where(d => d.RtechniqueEntityId != null).Select(d => d.RtechniqueEntityId).Distinct().ToList();
                //    if (techniqueIds.Count > 0)
                //    {
                //        var realIds = techniqueIds;
                //        var processesQuery = _rprocessesEntity.GetAllIncluding(p => p.WorkStepEntities).Where(d => realIds.Contains(d.RTechniqueEntityId)).OrderBy(n => n.ProcessesSequence);
                //        foreach (var item in processesQuery)
                //        {
                //            workStepList.AddRange(item.WorkStepEntities.OrderBy(d => d.WorkStepNumber).Select(d => d.Id));
                //        }
                //        workStepList = workStepList.Distinct().ToList();
                //    }
                //}
            }
            if (workStepList.Count > 0)
            {
                var routeDic = from work in _rworkStepEntity.GetAll()
                               join process in _rprocessesEntity.GetAll() on work.RProcessesEntityId equals process.Id
                               join tech in _rtechniqueEntity.GetAll() on work.RTechniqueEntityId equals tech.Id
                               where workStepList.Contains(work.Id)
                               select new RouteDic
                               {
                                   RWorkStepEntityId = work.Id,
                                   Route = tech.ModuleName + "-" + "工步" + process.ProcessesSequence + "-" + work.WorkStepNumber,
                                   OperationName = tech.TechniqueNumber,
                                   LotNo = tech.LotNo,
                               };
                Dictionary<Guid, string> mapRoute = new Dictionary<Guid, string>();
                Dictionary<Guid, string> mapOperationName = new Dictionary<Guid, string>();
                Dictionary<Guid, string> mapLotNo = new Dictionary<Guid, string>();
                foreach (var item in routeDic)
                {
                    mapRoute[item.RWorkStepEntityId] = item.Route;
                    mapOperationName[item.RWorkStepEntityId] = item.OperationName;
                    mapLotNo[item.RWorkStepEntityId] = item.LotNo;
                }
                if (tableNames.Contains("制造资源"))
                {
                    var data = from rm in _rMakeResourcesEntityRepository.GetAll().Where(d => workStepList.Contains(d.RWorkStepEntityId))
                               join ff in _rworkStepEntity.GetAll() on rm.RWorkStepEntityId equals ff.Id
                               join bb in _rprocessesEntity.GetAll() on ff.RProcessesEntityId equals bb.Id
                               orderby bb.ProcessesSequence, ff.WorkStepNumber, rm.Index
                               select rm;

                    if (!paging)
                    {
                        rworkStepOutDto.ManufacturingResources = ObjectMapper.Map<List<RManufacturingResourcesDto>>(data);
                    }
                    else
                    {
                        rworkStepOutDto.ManufacturingResources = ObjectMapper.Map<List<RManufacturingResourcesDto>>(data.Skip((pageIndex - 1) * pageSize).Take(pageSize));
                    }
                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "manufacturingResources";
                    table.TableName = "制造资源";

                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;

                    if (DisplayRoute)
                    {
                        rworkStepOutDto.ManufacturingResources.ForEach(d => d.Route = mapRoute[d.RWorkStepEntityId]);
                        table.FiledName.Add("路径");
                        table.FiledDesc.Add("route");
                    }
                    table.totalCount = data.Count();
                    tableNameDictionary.Add(table);

                }
                if (tableNames.Contains("视频"))
                {
                    var data = from rv in _rVideoEntityRepository.GetAll().Where(d => workStepList.Contains(d.RWorkStepEntityId))
                               join ff in _rworkStepEntity.GetAll() on rv.RWorkStepEntityId equals ff.Id
                               join bb in _rprocessesEntity.GetAll() on ff.RProcessesEntityId equals bb.Id
                               orderby bb.ProcessesSequence, ff.WorkStepNumber, rv.Index
                               select rv;
                    if (!paging)
                    {
                        rworkStepOutDto.Video = ObjectMapper.Map<List<RVideoFrequencyDto>>(data);
                    }
                    else
                    {
                        rworkStepOutDto.Video = ObjectMapper.Map<List<RVideoFrequencyDto>>(data.Skip((pageIndex - 1) * pageSize).Take(pageSize));
                    }

                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "video";
                    table.TableName = "视频";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    if (DisplayRoute)
                    {
                        rworkStepOutDto.Video.ForEach(d => d.Route = mapRoute[d.RWorkStepEntityId]);
                        table.FiledName.Add("路径");
                        table.FiledDesc.Add("route");
                    }

                    table.totalCount = data.Count();
                    tableNameDictionary.Add(table);
                }
                if (tableNames.Contains("装入件明细"))
                {

                    var data = from rv in _rLoadPieceRepository.GetAll().Where(d => workStepList.Contains(d.RWorkStepEntityId))
                               join ff in _rworkStepEntity.GetAll() on rv.RWorkStepEntityId equals ff.Id
                               join bb in _rprocessesEntity.GetAll() on ff.RProcessesEntityId equals bb.Id
                               orderby bb.ProcessesSequence, ff.WorkStepNumber, rv.Index
                               select rv;
                    //var data = _rLoadPieceRepository.GetAll().Where(d => workStepList.Contains(d.RWorkStepEntityId));
                    if (!paging)
                    {
                        rworkStepOutDto.InsertDetails = ObjectMapper.Map<List<RInsertDetailsDto>>(data);
                    }
                    else
                    {
                        rworkStepOutDto.InsertDetails = ObjectMapper.Map<List<RInsertDetailsDto>>(data.Skip((pageIndex - 1) * pageSize).Take(pageSize));
                    }

                    RtableNameDictionary table = new RtableNameDictionary();
                    table.TableKey = "insertDetails";
                    table.TableName = "装入件明细";
                    table.FiledDesc = filedMap[table.TableName].filedValue;
                    table.FiledName = filedMap[table.TableName].filedKey;
                    if (DisplayRoute)
                    {
                        rworkStepOutDto.InsertDetails.ForEach(d => d.Route = mapRoute[d.RWorkStepEntityId]);
                        table.FiledName.Add("路径");
                        table.FiledDesc.Add("route");
                    }
                    table.totalCount = data.Count();
                    tableNameDictionary.Add(table);
                }
                var tableData = (from cc in _rTableBaseEntity.GetAllIncluding(a => a.RecordRequirements, b => b.InspectionSignature, c => c.MeasuredResult, d => d.Environment, e => e.MultiMedia)
                                 join mm in workStepList on cc.RWorkStepEntityId equals mm

                                 join pp in tableNames on cc.FormName equals pp
                                 join bb in _rprocessesEntity.GetAll() on cc.RProcessesEntityId equals bb.Id
                                 join ff in _rworkStepEntity.GetAll() on cc.RWorkStepEntityId equals ff.Id
                                 orderby bb.ProcessesSequence, ff.WorkStepNumber
                                 select cc);
                //var tableData = (from cc in _rTableBaseEntity.GetAllIncluding(a => a.RecordRequirements, b => b.InspectionSignature, c => c.MeasuredResult, d => d.Environment, e => e.MultiMedia)
                //                 join mm in workStepList on cc.RWorkStepEntityId equals mm
                //                 join pp in tableNames on cc.FormName equals pp
                //                 join bb in _rprocessesEntity.GetAll() on cc.RProcessesEntityId equals bb.Id
                //                 join ff in _rworkStepEntity.GetAll() on cc.RWorkStepEntityId equals ff.Id
                //                 select new RTableBase
                //                 {
                //                     //基础元素
                //                     Id = cc.Id,
                //                     FormName = cc.FormName,
                //                     SerialNum = cc.SerialNum,
                //                     RWorkStepEntityId = cc.RWorkStepEntityId,
                //                     RProcessesEntityId = cc.RProcessesEntityId,
                //                     Sort = cc.Sort,
                //                     Deptment = cc.Deptment,
                //                     RecordRemark = cc.RecordRemark,
                //                     //InspectionSignature = cc.InspectionSignature,
                //                     //RecordRequirements = cc.RecordRequirements,
                //                     //MultiMedia = cc.MultiMedia,
                //                     //MeasuredResult = cc.MeasuredResult,
                //                     //Environment = cc.Environment,
                //                     //A2所属部段图号
                //                     ParentProductNum = cc.ParentProductNum,
                //                     ParentProductNum_DisplayName = cc.ParentProductNum_DisplayName,
                //                     //A3所属部段名称
                //                     ParentProductName = cc.ParentProductName,
                //                     ParentProductName_DisplayName = cc.ParentProductName_DisplayName,
                //                     //A4零件1图号/代号
                //                     FisrtDrawingNum = cc.FisrtDrawingNum,
                //                     FisrtDrawingNum_DisplayName = cc.FisrtDrawingNum_DisplayName,
                //                     //A5零件1名称
                //                     FirstDrawingName = cc.FirstDrawingName,
                //                     FirstDrawingName_DisplayName = cc.FirstDrawingName_DisplayName,
                //                     //A6零件2图号/代号
                //                     SecondDrawingNum = cc.SecondDrawingNum,
                //                     SecondDrawingNum_DisplayName = cc.SecondDrawingNum_DisplayName,
                //                     //A7零件2名称
                //                     SecondDrawingName = cc.SecondDrawingName,
                //                     SecondDrawingName_DisplayName = cc.SecondDrawingName_DisplayName,
                //                     //A8产品编号
                //                     ProductNum = cc.ProductNum,
                //                     ProductNum_DisplayName = cc.ProductNum_DisplayName,
                //                     //A9所属型号
                //                     Model = cc.Model,
                //                     Model_DisplayName = cc.Model_DisplayName,
                //                     //A10记录项目
                //                     RecordElement = cc.RecordElement,
                //                     RecordElement_DisplayName = cc.RecordElement_DisplayName,
                //                     //A11记录元素
                //                     RecordItem = cc.RecordItem,
                //                     RecordItem_DisplayName = cc.RecordItem_DisplayName,
                //                     //A12所用工具编号
                //                     ToolUsed = cc.ToolUsed,
                //                     ToolUsed_DisplayName = cc.ToolUsed_DisplayName,
                //                     //A13现场异常记录
                //                     AbnormalRecord = cc.AbnormalRecord,
                //                     AbnormalRecord_DisplayName = cc.AbnormalRecord_DisplayName,
                //                     //A14合格证号
                //                     Certificate = cc.Certificate,
                //                     Certificate_DisplayName = cc.Certificate_DisplayName,
                //                     //A15所用工具编号2
                //                     SecondToolUsed = cc.SecondToolUsed,
                //                     SecondToolUsed_DisplayName = cc.SecondToolUsed_DisplayName,
                //                     //A16所用工具编号3
                //                     ThirdToolUsed = cc.ThirdToolUsed,
                //                     ThirdToolUsed_DisplayName = cc.ThirdToolUsed_DisplayName,
                //                     //A17 参数代号
                //                     ParamCode = cc.ParamCode,
                //                     ParamCode_DisplayName = cc.ParamCode_DisplayName,
                //                     //工序工步号
                //                     ProcessesSequence = bb.ProcessesSequence,
                //                     WorkStepNumber = ff.WorkStepNumber
                //                 });
                //筛选条件
                if (!string.IsNullOrEmpty(FisrtDrawingNum))
                {
                    tableData = tableData.Where(d => d.FisrtDrawingNum.Contains(FisrtDrawingNum));
                }
                if (!string.IsNullOrEmpty(FirstDrawingName))
                {
                    tableData = tableData.Where(d => d.FirstDrawingName.Contains(FirstDrawingName));
                }
                if (!string.IsNullOrEmpty(SecondDrawingNum))
                {
                    tableData = tableData.Where(d => d.SecondDrawingNum.Contains(SecondDrawingNum));
                }
                if (!string.IsNullOrEmpty(SecondDrawingName))
                {
                    tableData = tableData.Where(d => d.SecondDrawingName.Contains(SecondDrawingName));
                }
                if (!string.IsNullOrEmpty(ToolUsed))
                {
                    tableData = tableData.Where(d => d.ToolUsed.Contains(ToolUsed));
                }
                if (!string.IsNullOrEmpty(RecordElementStr))
                {
                    tableData = tableData.Where(d => d.RecordElement.Contains(RecordElementStr));
                }
                if (tableData.Count() > 0)
                {
                    int pageRealIndex = 1;
                    if (tableNames.Contains("通用总装数据记录表"))
                    {
                        if (reachTable == "通用总装数据记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "通用总装数据记录表");
                        int count = bopData.Count();
                        if (paging)
                            bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.Assemble = ObjectMapper.Map<List<RassembleDto>>(bopData.ToList());
                        if (rworkStepOutDto.Assemble.Count > 0)
                        {

                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "assemble";
                            table.TableName = "通用总装数据记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;//前台抓取的表格 中文字段
                            table.FiledName = filedMap[table.TableName].filedKey;//前台抓取的表格 英文字段
                            //处理签署数据给前台显示
                            rworkStepOutDto.Assemble.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("通用记录表"))
                    {
                        if (reachTable == "通用记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "通用记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.GeneralRecords = ObjectMapper.Map<List<RgeneralRecordsDto>>(bopData.ToList());
                        if (rworkStepOutDto.GeneralRecords.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "generalRecords";
                            table.TableName = "通用记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.GeneralRecords.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("胶液配比情况记录表"))
                    {
                        if (reachTable == "胶液配比情况记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "胶液配比情况记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.GlueSolution = ObjectMapper.Map<List<RglueSolutionDto>>(bopData.ToList());
                        if (rworkStepOutDto.GlueSolution.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "glueSolution";
                            table.TableName = "胶液配比情况记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.GlueSolution.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("舱口盖开闭记录表"))
                    {
                        if (reachTable == "舱口盖开闭记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "舱口盖开闭记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.Hatch = ObjectMapper.Map<List<RhatchOpenShutDto>>(bopData.ToList());
                        if (rworkStepOutDto.Hatch.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "hatch";
                            table.TableName = "舱口盖开闭记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.Hatch.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });

                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("进箱舱登记表"))
                    {
                        if (reachTable == "进箱舱登记表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "进箱舱登记表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.InCabin = ObjectMapper.Map<List<RinCabinDto>>(bopData.ToList());
                        if (rworkStepOutDto.InCabin.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "inCabin";
                            table.TableName = "进箱（舱）登记表";
                            table.FiledDesc = filedMap["进箱舱登记表"].filedValue;
                            table.FiledName = filedMap["进箱舱登记表"].filedKey;
                            rworkStepOutDto.InCabin.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("具有证明书的主要零件记录表"))
                    {
                        if (reachTable == "具有证明书的主要零件记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "具有证明书的主要零件记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.MainParts = ObjectMapper.Map<List<RmainPartsDto>>(bopData.ToList());
                        if (rworkStepOutDto.MainParts.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "mainParts";
                            table.TableName = "具有证明书的主要零件记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.MainParts.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });

                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("力矩记录表"))
                    {
                        if (reachTable == "力矩记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "力矩记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.OrderBy(d => d.FisrtDrawingNum).ThenBy(d => d.SecondDrawingNum).ThenBy(d => d.RecordRequirements.DesignerDemand).ThenBy(d => d.RecordRequirements.ProcessorDemand).Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.Moment = ObjectMapper.Map<List<RmomentRecordingDto>>(bopData.ToList());
                        if (rworkStepOutDto.Moment.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "moment";
                            table.TableName = "力矩记录表";
                            List<string> filedName = new List<string>();
                            List<string> filedDesc = new List<string>();
                            if (envelope)
                            {
                                filedName.AddRange(new string[] { "序号", "零件1", "零件2", "设计要求_r拧紧值N", "工艺要求_r拧紧值N", "发次", "实际测量值N.m", "现场备注" });
                                filedDesc.AddRange(new string[] { "serialNum", "fisrtDrawingNum", "secondDrawingNum", "designerDemand", "processorDemand", "lotNo", "firstMeasuredValues", "recordRemark" });
                            }
                            else
                            {
                                filedName.AddRange(new string[] { "序号", "零件1", "零件2", "设计要求_r拧紧值N", "工艺要求_r拧紧值N", "实际测量值N.m", "所用工具编号", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" });
                                filedDesc.AddRange(new string[] { "serialNum", "fisrtDrawingNum", "secondDrawingNum", "designerDemand", "processorDemand", "firstMeasuredValues", "toolUsed", "remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" });
                            }
                            rworkStepOutDto.Moment.ForEach(d =>
                            {
                                d.LotNo = mapLotNo[d.RWorkStepEntityId];
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            rworkStepOutDto.Moment.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                            });
                            rworkStepOutDto.Moment = rworkStepOutDto.Moment.OrderBy(d => d.FisrtDrawingNum).ThenBy(d => d.SecondDrawingNum).ThenBy(d => d.DesignerDemand).ThenBy(d => d.ProcessorDemand).ThenBy(d => d.LotNo).ToList();
                            if (DisplayRoute)
                            {
                                filedName.Add("路径");
                                filedDesc.Add("route");
                            }
                            table.FiledDesc = filedDesc;
                            table.FiledName = filedName;
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("通用多媒体记录表"))
                    {
                        if (reachTable == "通用多媒体记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "通用多媒体记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.OrderBy(d => d.RecordElement).ThenBy(d => d.RecordRequirements.RecordLocation).Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.MultimediaRecord = ObjectMapper.Map<List<RmultimediaRecordDto>>(bopData.ToList());
                        if (rworkStepOutDto.MultimediaRecord.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "multimediaRecord";
                            table.TableName = "通用多媒体记录表";
                            List<string> filedName = new List<string>();
                            List<string> filedDesc = new List<string>();
                            if (envelope)
                            {
                                filedName.AddRange(new string[] { "序号", "项目", "部位", "发次", "拍照(影像)编号", "现场备注" });
                                filedDesc.AddRange(new string[] { "serialNum", "fisrtDrawingNum", "recordLocation", "lotNo", "photoNo", "recordRemark" });
                            }
                            else
                            {
                                filedName.AddRange(new string[] { "序号", "项目", "部位", "拍照/摄像", "拍照(影像)编号", "确认结果", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "现场备注" });
                                filedDesc.AddRange(new string[] { "serialNum", "fisrtDrawingNum", "recordLocation", "recordRequire", "photoNo", "firstConfirmResult", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "recordRemark" });
                            }

                            rworkStepOutDto.MultimediaRecord.ForEach(d =>
                            {
                                d.LotNo = mapLotNo[d.RWorkStepEntityId];
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });

                            rworkStepOutDto.MultimediaRecord = rworkStepOutDto.MultimediaRecord.OrderBy(d => d.FisrtDrawingNum).ThenBy(d => d.RecordLocation).ThenBy(d => d.LotNo).ToList();


                            if (DisplayRoute)
                            {
                                filedName.Add("路径");
                                filedDesc.Add("route");
                            }
                            table.FiledDesc = filedDesc;
                            table.FiledName = filedName;
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("通用力矩复校记录表"))
                    {
                        if (reachTable == "通用力矩复校记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "通用力矩复校记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.TorqueReCalibration = ObjectMapper.Map<List<RtorqueReCalibrationDto>>(bopData.ToList());
                        if (rworkStepOutDto.TorqueReCalibration.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "torqueReCalibration";
                            table.TableName = "通用力矩复校记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.TorqueReCalibration.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("质量控制记录表"))
                    {
                        if (reachTable == "质量控制记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "质量控制记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.QualityControl = ObjectMapper.Map<List<RqualityControlDto>>(bopData.ToList());
                        if (rworkStepOutDto.QualityControl.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "qualityControl";
                            table.TableName = "质量控制记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.QualityControl.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                //d.FourthOperator = GetAnalysisOperator(d.FourthOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.FifthOperator = GetAnalysisOperator(d.FifthOperator, mapOperationName[d.RWorkStepEntityId]);
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("电缆插头防水防热记录表"))
                    {
                        if (reachTable == "电缆插头防水防热记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "电缆插头防水防热记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.CablePlugWaterFireProofControl = ObjectMapper.Map<List<RcablePlugWaterFireProofDto>>(bopData.ToList());
                        if (rworkStepOutDto.CablePlugWaterFireProofControl.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "cablePlugWaterFireProofControl";
                            table.TableName = "电缆（插头）防水（防热）记录表";
                            table.FiledDesc = filedMap["电缆插头防水防热记录表"].filedValue;
                            table.FiledName = filedMap["电缆插头防水防热记录表"].filedKey;
                            rworkStepOutDto.CablePlugWaterFireProofControl.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("波纹管变形记录表"))
                    {
                        if (reachTable == "波纹管变形记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "波纹管变形记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.OrderBy(d => d.RecordRequirements.RecordLocation).ThenBy(d => d.FisrtDrawingNum).ThenBy(d => d.ProductNum).ThenBy(d => d.RecordElement).ThenBy(d => d.RecordRequirements.DesignerDemand).Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.BellowsDeformation = ObjectMapper.Map<List<RbellowsDeformationDto>>(bopData.ToList());
                        if (rworkStepOutDto.BellowsDeformation.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "bellowsDeformation";
                            table.TableName = "波纹管变形记录表";
                            List<string> filedName = new List<string>();
                            List<string> filedDesc = new List<string>();

                            if (envelope)
                            {
                                filedName.AddRange(new string[] { "序号", "波纹管", "所属管路", "管路编号", "装配初始压缩量方向", "允许值", "发次", "安装前", "安装后", "变形量", "现场备注" });
                                filedDesc.AddRange(new string[] { "serialNum", "recordLocation", "fisrtDrawingNum", "productNum", "recordElement", "designerDemand", "lotNo", "firstMeasuredValues", "secondMeasuredValues", "thirdMeasuredValues", "recordRemark" });
                            }
                            else
                            {
                                filedName.AddRange(new string[] { "序号", "波纹管", "所属管路", "管路编号", "装配初始压缩量方向", "允许值", "安装前", "安装后", "变形量", "所用工具编号", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" });
                                filedDesc.AddRange(new string[] { "serialNum", "recordLocation", "fisrtDrawingNum", "productNum", "recordElement", "designerDemand", "firstMeasuredValues", "secondMeasuredValues", "thirdMeasuredValues", "toolUsed", "remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" });
                            }
                            rworkStepOutDto.BellowsDeformation.ForEach(d =>
                            {
                                d.LotNo = mapLotNo[d.RWorkStepEntityId];
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            rworkStepOutDto.BellowsDeformation = rworkStepOutDto.BellowsDeformation.OrderBy(d => d.RecordLocation).ThenBy(d => d.FisrtDrawingNum).ThenBy(d => d.ProductNum).ThenBy(d => d.RecordElement).ThenBy(d => d.DesignerDemand).ThenBy(d => d.LotNo).ToList();
                            if (DisplayRoute)
                            {

                                filedName.Add("路径");
                                filedDesc.Add("route");
                            }

                            table.FiledDesc = filedDesc;
                            table.FiledName = filedName;
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("电连接器插接记录表"))
                    {
                        if (reachTable == "电连接器插接记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "电连接器插接记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ElectricalConnectInsertion = ObjectMapper.Map<List<RelectricalConnectInsertionDto>>(bopData.ToList());
                        if (rworkStepOutDto.ElectricalConnectInsertion.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "electricalConnectInsertion";
                            table.TableName = "电连接器插接记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ElectricalConnectInsertion.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                    d.SecondPhotoNo = GetPictureRouteNew(d.SecondPhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                    d.ThirdPhotoNo = GetPictureRouteNew(d.ThirdPhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                    d.FourthPhotoNo = GetPictureRouteNew(d.FourthPhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                    d.SecondPhotoNo = GetPictureRoute(d.SecondPhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                    d.ThirdPhotoNo = GetPictureRoute(d.ThirdPhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                    d.FourthPhotoNo = GetPictureRoute(d.FourthPhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //d.FourthOperator = GetAnalysisOperator(d.FourthOperator, mapOperationName[d.RWorkStepEntityId]);
                                ////}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                d.FourthOperator = GetOperatorUserName(d.FourthOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("舱口盖开闭测试记录表"))
                    {
                        if (reachTable == "舱口盖开闭测试记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "舱口盖开闭测试记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.HatchOpenShutTest = ObjectMapper.Map<List<RHatchOpenShutTestDto>>(bopData.ToList());
                        if (rworkStepOutDto.HatchOpenShutTest.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "hatchOpenShutTest";
                            table.TableName = "舱口盖开闭测试记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.HatchOpenShutTest.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("产品接地状态检查记录表"))
                    {
                        if (reachTable == "产品接地状态检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "产品接地状态检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ProductGroundingStatus = ObjectMapper.Map<List<RProductGroundingStatusDto>>(bopData.ToList());
                        if (rworkStepOutDto.ProductGroundingStatus.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "productGroundingStatus";
                            table.TableName = "产品接地状态检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ProductGroundingStatus.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("强制检验点记录表"))
                    {
                        if (reachTable == "强制检验点记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "强制检验点记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ForcedCheckpoint = ObjectMapper.Map<List<RForcedCheckpointDto>>(bopData.ToList());
                        if (rworkStepOutDto.ForcedCheckpoint.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "forcedCheckpoint";
                            table.TableName = "强制检验点记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ForcedCheckpoint.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.FourthOperator = GetAnalysisOperator(d.FourthOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.FifthOperator = GetAnalysisOperator(d.FifthOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                d.FourthOperator = GetOperatorUserName(d.FourthOperator);
                                d.FifthOperator = GetOperatorUserName(d.FifthOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("自动关闭口盖检查记录表"))
                    {
                        if (reachTable == "自动关闭口盖检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "自动关闭口盖检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.AutomaticShutoff = ObjectMapper.Map<List<RAutomaticShutoffDto>>(bopData.ToList());
                        if (rworkStepOutDto.AutomaticShutoff.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "automaticShutoff";
                            table.TableName = "自动关闭口盖检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.AutomaticShutoff.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("伺服机构工艺拉杆长度记录表"))
                    {
                        if (reachTable == "伺服机构工艺拉杆长度记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "伺服机构工艺拉杆长度记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.Servomechanism = ObjectMapper.Map<List<RServomechanismDto>>(bopData.ToList());
                        if (rworkStepOutDto.Servomechanism.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "servomechanism";
                            table.TableName = "伺服机构工艺拉杆长度记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.Servomechanism.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("状态检查表"))
                    {
                        if (reachTable == "状态检查表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "状态检查表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.StatusCheck = ObjectMapper.Map<List<RStatusCheckDto>>(bopData.ToList());
                        if (rworkStepOutDto.StatusCheck.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "statusCheck";
                            table.TableName = "状态检查表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.StatusCheck.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("问题记录表"))
                    {
                        if (reachTable == "问题记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "问题记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ProblemRecord = ObjectMapper.Map<List<RProblemRecordDto>>(bopData.ToList());
                        if (rworkStepOutDto.ProblemRecord.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "problemRecord";
                            table.TableName = "问题记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ProblemRecord.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("爆索尺寸测量记录表"))
                    {
                        if (reachTable == "爆索尺寸测量记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "爆索尺寸测量记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.DetonatingCableSize = ObjectMapper.Map<List<RDetonatingCableSizeDto>>(bopData.ToList());
                        if (rworkStepOutDto.DetonatingCableSize.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "detonatingCableSize";
                            table.TableName = "爆索尺寸测量记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.DetonatingCableSize.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("整流罩星箭分离弹簧压缩数据记录表"))
                    {
                        if (reachTable == "整流罩星箭分离弹簧压缩数据记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "整流罩星箭分离弹簧压缩数据记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ReleaseSpringCompression = ObjectMapper.Map<List<RReleaseSpringCompressionDto>>(bopData.ToList());
                        if (rworkStepOutDto.ReleaseSpringCompression.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "releaseSpringCompression";
                            table.TableName = "整流罩/星箭分离弹簧压缩数据记录表";
                            table.FiledDesc = filedMap["整流罩星箭分离弹簧压缩数据记录表"].filedValue;
                            table.FiledName = filedMap["整流罩星箭分离弹簧压缩数据记录表"].filedKey;
                            rworkStepOutDto.ReleaseSpringCompression.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("载荷支架组合体形位数据记录表"))
                    {
                        if (reachTable == "载荷支架组合体形位数据记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "载荷支架组合体形位数据记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.LoadBracket = ObjectMapper.Map<List<RLoadBracketDto>>(bopData.ToList());
                        if (rworkStepOutDto.LoadBracket.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "loadBracket";
                            table.TableName = "载荷支架组合体形位数据记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.LoadBracket.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("设计签署总装数据记录表"))
                    {
                        if (reachTable == "设计签署总装数据记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "设计签署总装数据记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.DesignGeneralAssemble = ObjectMapper.Map<List<RDesignGeneralAssembleDto>>(bopData.ToList());
                        if (rworkStepOutDto.DesignGeneralAssemble.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "designGeneralAssemble";
                            table.TableName = "设计签署总装数据记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.DesignGeneralAssemble.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.FourthOperator = GetAnalysisOperator(d.FourthOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                d.FourthOperator = GetOperatorUserName(d.FourthOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("管路活门气密点检查记录表皂泡法"))
                    {
                        if (reachTable == "管路活门气密点检查记录表皂泡法")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "管路活门气密点检查记录表皂泡法");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.SoapBubble = ObjectMapper.Map<List<RSoapBubbleDto>>(bopData.ToList());
                        if (rworkStepOutDto.SoapBubble.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "soapBubble";
                            table.TableName = "管路活门气密点检查记录表皂泡法";
                            table.FiledDesc = filedMap["管路活门气密点检查记录表皂泡法"].filedValue;
                            table.FiledName = filedMap["管路活门气密点检查记录表皂泡法"].filedKey;
                            rworkStepOutDto.SoapBubble.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("管路活门气密点检查记录表氦质谱法"))
                    {
                        if (reachTable == "管路活门气密点检查记录表氦质谱法")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "管路活门气密点检查记录表氦质谱法");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.HeliumMassSpectrometry = ObjectMapper.Map<List<RHeliumMassSpectrometryDto>>(bopData.ToList());
                        if (rworkStepOutDto.HeliumMassSpectrometry.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "heliumMassSpectrometry";
                            table.TableName = "管路活门气密点检查记录表氦质谱法";
                            table.FiledDesc = filedMap["管路活门气密点检查记录表氦质谱法"].filedValue;
                            table.FiledName = filedMap["管路活门气密点检查记录表氦质谱法"].filedKey;
                            rworkStepOutDto.HeliumMassSpectrometry.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("除了打保险防松外的总装直属件记录表"))
                    {
                        if (reachTable == "除了打保险防松外的总装直属件记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "除了打保险防松外的总装直属件记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.FinalAssemblyParts = ObjectMapper.Map<List<RFinalAssemblyPartsDto>>(bopData.ToList());
                        if (rworkStepOutDto.FinalAssemblyParts.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "finalAssemblyParts";
                            table.TableName = "除了打保险防松外的总装直属件记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.FinalAssemblyParts.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("传感器安装测试记录情况统计记录表"))
                    {
                        if (reachTable == "传感器安装测试记录情况统计记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "传感器安装测试记录情况统计记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.SensorInstallation = ObjectMapper.Map<List<RSensorInstallationDto>>(bopData.ToList());
                        if (rworkStepOutDto.SensorInstallation.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "sensorInstallation";
                            table.TableName = "传感器安装测试记录情况统计记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.SensorInstallation.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("插头状态检查表"))
                    {
                        if (reachTable == "插头状态检查表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "插头状态检查表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.PlugStatus = ObjectMapper.Map<List<RPlugStatusDto>>(bopData.ToList());
                        if (rworkStepOutDto.PlugStatus.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "plugStatus";
                            table.TableName = "插头状态检查表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            // var operationName = _rtechniqueEntity.GetAll().Where(d => d.Id == workStep.RTechniqueEntityId).First().TechniqueNumber;
                            rworkStepOutDto.PlugStatus.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("惯组安装记录表一"))
                    {
                        if (reachTable == "惯组安装记录表一")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "惯组安装记录表一");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.FirstIMUInstallation = ObjectMapper.Map<List<RFirstIMUInstallationDto>>(bopData.ToList());
                        if (rworkStepOutDto.FirstIMUInstallation.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "firstIMUInstallation";
                            table.TableName = "惯组安装记录表一";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.FirstIMUInstallation.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("惯组安装记录表二"))
                    {
                        if (reachTable == "惯组安装记录表二")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "惯组安装记录表二");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.SecondIMUInstallation = ObjectMapper.Map<List<RSecondIMUInstallationDto>>(bopData.ToList());
                        if (rworkStepOutDto.SecondIMUInstallation.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "secondIMUInstallation";
                            table.TableName = "惯组安装记录表二";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.SecondIMUInstallation.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("电缆高度测量记录表"))
                    {
                        if (reachTable == "电缆高度测量记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "电缆高度测量记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.CableHeight = ObjectMapper.Map<List<RCableHeightDto>>(bopData.ToList());
                        if (rworkStepOutDto.CableHeight.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "cableHeight";
                            table.TableName = "电缆高度测量记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.CableHeight.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("压接实验测量记录表低频"))
                    {
                        if (reachTable == "压接实验测量记录表低频")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "压接实验测量记录表低频");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.LowCrimpingExperiment = ObjectMapper.Map<List<RLowCrimpingExperimentDto>>(bopData.ToList());
                        if (rworkStepOutDto.LowCrimpingExperiment.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "lowCrimpingExperiment";
                            table.TableName = "压接实验测量记录表低频";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.LowCrimpingExperiment.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("电缆剥线试验记录表低频"))
                    {
                        if (reachTable == "电缆剥线试验记录表低频")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "电缆剥线试验记录表低频");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.LowFrequencyCableStripping = ObjectMapper.Map<List<RLowFrequencyCableStrippingDto>>(bopData.ToList());
                        if (rworkStepOutDto.LowFrequencyCableStripping.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "lowFrequencyCableStripping";
                            table.TableName = "电缆剥线试验记录表（低频）";
                            table.FiledDesc = filedMap["电缆剥线试验记录表低频"].filedValue;
                            table.FiledName = filedMap["电缆剥线试验记录表低频"].filedKey;
                            rworkStepOutDto.LowFrequencyCableStripping.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("电缆剥线试验记录表高频"))
                    {
                        if (reachTable == "电缆剥线试验记录表高频")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "电缆剥线试验记录表高频");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.HighFrequencyCableStripping = ObjectMapper.Map<List<RHighFrequencyCableStrippingDto>>(bopData.ToList());
                        if (rworkStepOutDto.HighFrequencyCableStripping.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "highFrequencyCableStripping";
                            table.TableName = "电缆剥线试验记录表（高频）";
                            table.FiledDesc = filedMap["电缆剥线试验记录表高频"].filedValue;
                            table.FiledName = filedMap["电缆剥线试验记录表高频"].filedKey;
                            rworkStepOutDto.HighFrequencyCableStripping.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("仪器接收检查记录表"))
                    {
                        if (reachTable == "仪器接收检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "仪器接收检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.InstrumentCheck = ObjectMapper.Map<List<RInstrumentCheckDto>>(bopData.ToList());
                        if (rworkStepOutDto.InstrumentCheck.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "instrumentCheck";
                            table.TableName = "仪器接收检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.InstrumentCheck.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("电缆接收检查记录表"))
                    {
                        if (reachTable == "电缆接收检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "电缆接收检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.CableReceivingInspection = ObjectMapper.Map<List<RCableReceivingInspectionDto>>(bopData.ToList());
                        if (rworkStepOutDto.CableReceivingInspection.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "cableReceivingInspection";
                            table.TableName = "电缆接收检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.CableReceivingInspection.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("箭地接口保护件检查记录表"))
                    {
                        if (reachTable == "箭地接口保护件检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "箭地接口保护件检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ArrowInterfaceProtectCheck = ObjectMapper.Map<List<RArrowInterfaceProtectCheckDto>>(bopData.ToList());
                        if (rworkStepOutDto.ArrowInterfaceProtectCheck.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "arrowInterfaceProtectCheck";
                            table.TableName = "箭地接口保护件检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ArrowInterfaceProtectCheck.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("通用检查记录表"))
                    {
                        if (reachTable == "通用检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "通用检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.InspectionRecord = ObjectMapper.Map<List<RInspectionRecordDto>>(bopData.ToList());
                        if (rworkStepOutDto.InspectionRecord.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "inspectionRecord";
                            table.TableName = "通用检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.InspectionRecord.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("对接面形位记录表"))
                    {
                        if (reachTable == "对接面形位记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "对接面形位记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.DockSurfaceMorpheme = ObjectMapper.Map<List<RDockSurfaceMorphemeDto>>(bopData.ToList());
                        if (rworkStepOutDto.DockSurfaceMorpheme.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "dockSurfaceMorpheme";
                            table.TableName = "对接面形位记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.DockSurfaceMorpheme.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("整流罩锉修记录表"))
                    {
                        if (reachTable == "整流罩锉修记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "整流罩锉修记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.FilingFileRepair = ObjectMapper.Map<List<RFilingFileRepairDto>>(bopData.ToList());
                        if (rworkStepOutDto.FilingFileRepair.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "filingFileRepair";
                            table.TableName = "整流罩锉修记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.FilingFileRepair.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("整流罩安装后检查记录表"))
                    {
                        if (reachTable == "整流罩安装后检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "整流罩安装后检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.CheckFairingAfterInstallation = ObjectMapper.Map<List<RCheckFairingAfterInstallationDto>>(bopData.ToList());
                        if (rworkStepOutDto.CheckFairingAfterInstallation.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "checkFairingAfterInstallation";
                            table.TableName = "整流罩安装后检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.CheckFairingAfterInstallation.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("导管检查记录表"))
                    {
                        if (reachTable == "导管检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "导管检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.Catheterization = ObjectMapper.Map<List<RcatheterizationDto>>(bopData.ToList());
                        if (rworkStepOutDto.Catheterization.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "catheterization";
                            table.TableName = "导管检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.Catheterization.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.FourthOperator = GetAnalysisOperator(d.FourthOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                d.FourthOperator = GetOperatorUserName(d.FourthOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("管路上箭前吹除记录表"))
                    {
                        if (reachTable == "管路上箭前吹除记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "管路上箭前吹除记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.BlowPipeArrow = ObjectMapper.Map<List<RblowPipeArrowDto>>(bopData.ToList());
                        if (rworkStepOutDto.BlowPipeArrow.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "blowPipeArrow";
                            table.TableName = "管路上箭前吹除记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.BlowPipeArrow.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("气封管流量测试记录表"))
                    {
                        if (reachTable == "气封管流量测试记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "气封管流量测试记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.GasPipeTest = ObjectMapper.Map<List<RgasPipeTestDto>>(bopData.ToList());
                        if (rworkStepOutDto.GasPipeTest.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "gasPipeTest";
                            table.TableName = "气封管流量测试记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.GasPipeTest.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("阀门气瓶过滤器流量计输送管金属软管等检查记录表"))
                    {
                        if (reachTable == "阀门气瓶过滤器流量计输送管金属软管等检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "阀门气瓶过滤器流量计输送管金属软管等检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ValvesGasInspection = ObjectMapper.Map<List<RvalvesGasInspectionDto>>(bopData.ToList());
                        if (rworkStepOutDto.ValvesGasInspection.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "valvesGasInspection";
                            table.TableName = "阀门、气瓶、过滤器、流量计、输送管、金属软管等检查记录表";
                            table.FiledDesc = filedMap["阀门气瓶过滤器流量计输送管金属软管等检查记录表"].filedValue;
                            table.FiledName = filedMap["阀门气瓶过滤器流量计输送管金属软管等检查记录表"].filedKey;
                            rworkStepOutDto.ValvesGasInspection.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("单机安装位置记录表"))
                    {
                        if (reachTable == "单机安装位置记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "单机安装位置记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.InstallationLocation = ObjectMapper.Map<List<RinstallationLocationDto>>(bopData.ToList());
                        if (rworkStepOutDto.InstallationLocation.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "installationLocation";
                            table.TableName = "单机安装位置记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.InstallationLocation.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("安装距离记录表"))
                    {
                        if (reachTable == "安装距离记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "安装距离记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.InstallationDistance = ObjectMapper.Map<List<RinstallationDistanceDto>>(bopData.ToList());
                        if (rworkStepOutDto.InstallationDistance.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "installationDistance";
                            table.TableName = "安装距离记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.InstallationDistance.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("小导管卡箍间距测量表"))
                    {
                        if (reachTable == "小导管卡箍间距测量表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "小导管卡箍间距测量表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.MeasurementSpacingConduit = ObjectMapper.Map<List<RmeasurementSpacingConduitDto>>(bopData.ToList());
                        if (rworkStepOutDto.MeasurementSpacingConduit.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "measurementSpacingConduit";
                            table.TableName = "小导管卡箍间距测量表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.MeasurementSpacingConduit.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("未按要求施加力矩及未打保险防松记录表"))
                    {
                        if (reachTable == "未按要求施加力矩及未打保险防松记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "未按要求施加力矩及未打保险防松记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.FailureAequiredLoosInsurance = ObjectMapper.Map<List<RfailureAequiredLoosInsuranceDto>>(bopData.ToList());
                        if (rworkStepOutDto.FailureAequiredLoosInsurance.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "failureAequiredLoosInsurance";
                            table.TableName = "未按要求施加力矩及未打保险防松记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.FailureAequiredLoosInsurance.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("分解重装记录表"))
                    {
                        if (reachTable == "分解重装记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "分解重装记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.DisassemblyReassembly = ObjectMapper.Map<List<RdisassemblyReassemblyDto>>(bopData.ToList());
                        if (rworkStepOutDto.DisassemblyReassembly.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "disassemblyReassembly";
                            table.TableName = "分解重装记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.DisassemblyReassembly.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("配合七零三绝热记录表"))
                    {
                        if (reachTable == "配合七零三绝热记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "配合七零三绝热记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.Insulation703 = ObjectMapper.Map<List<Rinsulation703Dto>>(bopData.ToList());
                        if (rworkStepOutDto.Insulation703.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "insulation703";
                            table.TableName = "配合七零三绝热记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.Insulation703.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("绝热去除记录表"))
                    {
                        if (reachTable == "绝热去除记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "绝热去除记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.AdiabaticRemoval = ObjectMapper.Map<List<RadiabaticRemovalDto>>(bopData.ToList());
                        if (rworkStepOutDto.AdiabaticRemoval.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "adiabaticRemoval";
                            table.TableName = "绝热去除记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.AdiabaticRemoval.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("连续拧紧环节力矩复校记录表"))
                    {
                        if (reachTable == "连续拧紧环节力矩复校记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "连续拧紧环节力矩复校记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.CalibrationContinuousTorque = ObjectMapper.Map<List<RcalibrationContinuousTorqueDto>>(bopData.ToList());
                        if (rworkStepOutDto.CalibrationContinuousTorque.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "calibrationContinuousTorque";
                            table.TableName = "连续拧紧环节力矩复校记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.CalibrationContinuousTorque.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("管路垫块安装情况记录表"))
                    {
                        if (reachTable == "管路垫块安装情况记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "管路垫块安装情况记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.InstallationPipeCushion = ObjectMapper.Map<List<RinstallationPipeCushionDto>>(bopData.ToList());
                        if (rworkStepOutDto.InstallationPipeCushion.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "installationPipeCushion";
                            table.TableName = "管路垫块安装情况记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.InstallationPipeCushion.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("箭体结构防水记录表"))
                    {
                        if (reachTable == "箭体结构防水记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "箭体结构防水记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ArrowStructureWaterproof = ObjectMapper.Map<List<RarrowStructureWaterproofDto>>(bopData.ToList());
                        if (rworkStepOutDto.ArrowStructureWaterproof.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "arrowStructureWaterproof";
                            table.TableName = "箭体结构防水记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ArrowStructureWaterproof.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("搭接线安装部位防水记录表"))
                    {
                        if (reachTable == "搭接线安装部位防水记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "搭接线安装部位防水记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.WaterproofInstallationLapd = ObjectMapper.Map<List<RwaterproofInstallationLapdDto>>(bopData.ToList());
                        if (rworkStepOutDto.WaterproofInstallationLapd.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "waterproofInstallationLapd";
                            table.TableName = "搭接线安装部位防水记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.WaterproofInstallationLapd.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("箭体称重时多装少装产品记录表"))
                    {
                        if (reachTable == "箭体称重时多装少装产品记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "箭体称重时多装少装产品记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ArrowScalageProducts = ObjectMapper.Map<List<RarrowScalageProductsDto>>(bopData.ToList());
                        if (rworkStepOutDto.ArrowScalageProducts.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "arrowScalageProducts";
                            table.TableName = "箭体称重时多装少装产品记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ArrowScalageProducts.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("箭体称重记录表"))
                    {
                        if (reachTable == "箭体称重记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "箭体称重记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ArrowWeight = ObjectMapper.Map<List<RarrowWeightDto>>(bopData.ToList());
                        if (rworkStepOutDto.ArrowWeight.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "arrowWeight";
                            table.TableName = "箭体称重记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ArrowWeight.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("总装零件称重记录表"))
                    {
                        if (reachTable == "总装零件称重记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "总装零件称重记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.Assemnleweighing = ObjectMapper.Map<List<RassemnleweighingDto>>(bopData.ToList());
                        if (rworkStepOutDto.Assemnleweighing.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "assemnleweighing";
                            table.TableName = "总装零件称重记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.Assemnleweighing.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("阀门安装状态确认表"))
                    {
                        if (reachTable == "阀门安装状态确认表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "阀门安装状态确认表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ConfirmationStatus = ObjectMapper.Map<List<RconfirmationStatusDto>>(bopData.ToList());
                        if (rworkStepOutDto.ConfirmationStatus.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "confirmationStatus";
                            table.TableName = "阀门安装状态确认表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ConfirmationStatus.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("传感器变换器对应关系确认记录表"))
                    {
                        if (reachTable == "传感器变换器对应关系确认记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "传感器变换器对应关系确认记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.CorrespondingRelationship = ObjectMapper.Map<List<RcorrespondingRelationshipDto>>(bopData.ToList());
                        if (rworkStepOutDto.CorrespondingRelationship.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "correspondingRelationship";
                            table.TableName = "传感器变换器对应关系确认记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.CorrespondingRelationship.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("密封插头压接多媒体记录表"))
                    {
                        if (reachTable == "密封插头压接多媒体记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "密封插头压接多媒体记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.CrimpingSealedPlug = ObjectMapper.Map<List<RcrimpingSealedPlugDto>>(bopData.ToList());
                        if (rworkStepOutDto.CrimpingSealedPlug.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "crimpingSealedPlug";
                            table.TableName = "密封插头压接多媒体记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.CrimpingSealedPlug.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.FourthOperator = GetAnalysisOperator(d.FourthOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                d.FourthOperator = GetOperatorUserName(d.FourthOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("气瓶组充放气速率记录表"))
                    {
                        if (reachTable == "气瓶组充放气速率记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "气瓶组充放气速率记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.CylinderGroup = ObjectMapper.Map<List<RcylinderGroupDto>>(bopData.ToList());
                        if (rworkStepOutDto.CylinderGroup.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "cylinderGroup";
                            table.TableName = "气瓶组充放气速率记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.CylinderGroup.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("气瓶压力测试记录表"))
                    {
                        if (reachTable == "气瓶压力测试记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "气瓶压力测试记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.CylinderPressureTest = ObjectMapper.Map<List<RcylinderPressureTestDto>>(bopData.ToList());
                        if (rworkStepOutDto.CylinderPressureTest.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "cylinderPressureTest";
                            table.TableName = "气瓶压力测试记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.CylinderPressureTest.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("干燥剂检查记录表"))
                    {
                        if (reachTable == "干燥剂检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "干燥剂检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.DesiccantInspection = ObjectMapper.Map<List<RdesiccantInspectionDto>>(bopData.ToList());
                        if (rworkStepOutDto.DesiccantInspection.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "desiccantInspection";
                            table.TableName = "干燥剂检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.DesiccantInspection.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);

                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("低频压接实验测量记录表"))
                    {
                        if (reachTable == "低频压接实验测量记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "低频压接实验测量记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ExperimentalCrimping = ObjectMapper.Map<List<RexperimentalCrimpingDto>>(bopData.ToList());
                        if (rworkStepOutDto.ExperimentalCrimping.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "experimentalCrimping";
                            table.TableName = "低频压接实验测量记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ExperimentalCrimping.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("飞行质量质心皮重及参数记录表"))
                    {
                        if (reachTable == "飞行质量质心皮重及参数记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "飞行质量质心皮重及参数记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.FlightMassCentroidTareWeight = ObjectMapper.Map<List<RflightMassCentroidTareWeightDto>>(bopData.ToList());
                        if (rworkStepOutDto.FlightMassCentroidTareWeight.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "flightMassCentroidTareWeight";
                            table.TableName = "飞行质量质心皮重及参数记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.FlightMassCentroidTareWeight.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("气封流量测试记录表"))
                    {
                        if (reachTable == "气封流量测试记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "气封流量测试记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.GasSealFlowTest = ObjectMapper.Map<List<RgasSealFlowTestDto>>(bopData.ToList());
                        if (rworkStepOutDto.GasSealFlowTest.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "gasSealFlowTest";
                            table.TableName = "气封流量测试记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.GasSealFlowTest.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("总装耗材称重记录表"))
                    {
                        if (reachTable == "总装耗材称重记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "总装耗材称重记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.GeneralWeighing = ObjectMapper.Map<List<RgeneralWeighingDto>>(bopData.ToList());
                        if (rworkStepOutDto.GeneralWeighing.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "generalWeighing";
                            table.TableName = "总装耗材称重记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.GeneralWeighing.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("高频压接点电阻及抗电强度检查记录表"))
                    {
                        if (reachTable == "高频压接点电阻及抗电强度检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "高频压接点电阻及抗电强度检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.HighFrequencyVoltage = ObjectMapper.Map<List<RhighFrequencyVoltageDto>>(bopData.ToList());
                        if (rworkStepOutDto.HighFrequencyVoltage.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "highFrequencyVoltage";
                            table.TableName = "高频压接点电阻及抗电强度检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.HighFrequencyVoltage.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("产品安装数量记录表"))
                    {
                        if (reachTable == "产品安装数量记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "产品安装数量记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.InstallationQuantity = ObjectMapper.Map<List<RinstallationQuantityDto>>(bopData.ToList());
                        if (rworkStepOutDto.InstallationQuantity.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "installationQuantity";
                            table.TableName = "产品安装数量记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.InstallationQuantity.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("接口检查记录表"))
                    {
                        if (reachTable == "接口检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "接口检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.InterfaceCheck = ObjectMapper.Map<List<RinterfaceCheckDto>>(bopData.ToList());
                        if (rworkStepOutDto.InterfaceCheck.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "interfaceCheck";
                            table.TableName = "接口检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.InterfaceCheck.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("岗位分工表"))
                    {
                        if (reachTable == "岗位分工表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "岗位分工表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.JobDivision = ObjectMapper.Map<List<RjobDivisionDto>>(bopData.ToList());
                        if (rworkStepOutDto.JobDivision.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "jobDivision";
                            table.TableName = "岗位分工表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.JobDivision.ForEach(d =>
                            {

                                d.FirstMeasuredValues = GetAnalysisMeasuredValuesOperator(d.FirstMeasuredValues);
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.FourthOperator = GetAnalysisOperator(d.FourthOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                d.FourthOperator = GetOperatorUserName(d.FourthOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("随大部段交付产品明细表"))
                    {
                        if (reachTable == "随大部段交付产品明细表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "随大部段交付产品明细表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.LargePartsDelivery = ObjectMapper.Map<List<RlargePartsDeliveryDto>>(bopData.ToList());
                        if (rworkStepOutDto.LargePartsDelivery.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "largePartsDelivery";
                            table.TableName = "随大部段交付产品明细表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.LargePartsDelivery.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("飞行质量质心设备调平数据记录表"))
                    {
                        if (reachTable == "飞行质量质心设备调平数据记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "飞行质量质心设备调平数据记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.LevelingDataFlight = ObjectMapper.Map<List<RlevelingDataFlightDto>>(bopData.ToList());
                        if (rworkStepOutDto.LevelingDataFlight.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "levelingDataFlight";
                            table.TableName = "飞行质量质心设备调平数据记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.LevelingDataFlight.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("液位传感器尺寸协调记录表"))
                    {
                        if (reachTable == "液位传感器尺寸协调记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "液位传感器尺寸协调记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.LiquidLevelSensor = ObjectMapper.Map<List<RliquidLevelSensorDto>>(bopData.ToList());
                        if (rworkStepOutDto.LiquidLevelSensor.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "liquidLevelSensor";
                            table.TableName = "液位传感器尺寸协调记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.LiquidLevelSensor.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("产品安装确认表"))
                    {
                        if (reachTable == "产品安装确认表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "产品安装确认表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ProductInstallationConfirmation = ObjectMapper.Map<List<RproductInstallationConfirmationDto>>(bopData.ToList());
                        if (rworkStepOutDto.ProductInstallationConfirmation.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "productInstallationConfirmation";
                            table.TableName = "产品安装确认表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ProductInstallationConfirmation.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("通用保护件检查记录表"))
                    {
                        if (reachTable == "通用保护件检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "通用保护件检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ProtectiveParts = ObjectMapper.Map<List<RprotectivePartsDto>>(bopData.ToList());
                        if (rworkStepOutDto.ProtectiveParts.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "protectiveParts";
                            table.TableName = "通用保护件检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ProtectiveParts.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("象限标识检查记录表"))
                    {
                        if (reachTable == "象限标识检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "象限标识检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.QuadrantCheck = ObjectMapper.Map<List<RquadrantCheckDto>>(bopData.ToList());
                        if (rworkStepOutDto.QuadrantCheck.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "quadrantCheck";
                            table.TableName = "象限标识检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.QuadrantCheck.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("通用接收检查记录表"))
                    {
                        if (reachTable == "通用接收检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "通用接收检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ReceivingInspectionRecord = ObjectMapper.Map<List<RreceivingInspectionRecordDto>>(bopData.ToList());
                        if (rworkStepOutDto.ReceivingInspectionRecord.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "receivingInspectionRecord";
                            table.TableName = "通用接收检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ReceivingInspectionRecord.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("系统保压记录表"))
                    {
                        if (reachTable == "系统保压记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "系统保压记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.SystemPressureMaintaining = ObjectMapper.Map<List<RsystemPressureMaintainingDto>>(bopData.ToList());
                        if (rworkStepOutDto.SystemPressureMaintaining.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "systemPressureMaintaining";
                            table.TableName = "系统保压记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.SystemPressureMaintaining.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("电磁阀尾罩检查表"))
                    {
                        if (reachTable == "电磁阀尾罩检查表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "电磁阀尾罩检查表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.TailCoverSolenoid = ObjectMapper.Map<List<RtailCoverSolenoidDto>>(bopData.ToList());
                        if (rworkStepOutDto.TailCoverSolenoid.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "tailCoverSolenoid";
                            table.TableName = "电磁阀尾罩检查表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.TailCoverSolenoid.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("高频压接点抗拉强度检查记录表"))
                    {
                        if (reachTable == "高频压接点抗拉强度检查记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "高频压接点抗拉强度检查记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.TensileStrengthHigh = ObjectMapper.Map<List<RtensileStrengthHighDto>>(bopData.ToList());
                        if (rworkStepOutDto.TensileStrengthHigh.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "tensileStrengthHigh";
                            table.TableName = "高频压接点抗拉强度检查记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.TensileStrengthHigh.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("横向质心测量记录表"))
                    {
                        if (reachTable == "横向质心测量记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "横向质心测量记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.TransverseCentroid = ObjectMapper.Map<List<RtransverseCentroidDto>>(bopData.ToList());
                        if (rworkStepOutDto.TransverseCentroid.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "transverseCentroid";
                            table.TableName = "横向质心测量记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.TransverseCentroid.ForEach(d =>
                            {
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("阀门测试记录表一"))
                    {
                        if (reachTable == "阀门测试记录表一")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "阀门测试记录表一");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ValveTest = ObjectMapper.Map<List<RvalveTestDto>>(bopData.ToList());
                        if (rworkStepOutDto.ValveTest.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "valveTest";
                            table.TableName = "阀门测试记录表一";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ValveTest.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("阀门测试记录表二"))
                    {
                        if (reachTable == "阀门测试记录表二")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "阀门测试记录表二");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ValveTestSec = ObjectMapper.Map<List<RvalveTestSecDto>>(bopData.ToList());
                        if (rworkStepOutDto.ValveTestSec.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "valveTestSec";
                            table.TableName = "阀门测试记录表二";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ValveTestSec.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("阀门使用次数记录表"))
                    {
                        if (reachTable == "阀门使用次数记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "阀门使用次数记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.ValveUsageTimes = ObjectMapper.Map<List<RvalveUsageTimesDto>>(bopData.ToList());
                        if (rworkStepOutDto.ValveUsageTimes.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "valveUsageTimes";
                            table.TableName = "阀门使用次数记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.ValveUsageTimes.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("大部段称重记录表"))
                    {
                        if (reachTable == "大部段称重记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "大部段称重记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.LargeSectionWeight = ObjectMapper.Map<List<RlargeSectionWeightDto>>(bopData.ToList());
                        if (rworkStepOutDto.LargeSectionWeight.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "largeSectionWeight ";
                            table.TableName = "大部段称重记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.LargeSectionWeight.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("电连接器插接多媒体记录表"))
                    {
                        if (reachTable == "电连接器插接多媒体记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "电连接器插接多媒体记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.MultimediaElectricalConnect = ObjectMapper.Map<List<RmultimediaElectricalConnectDto>>(bopData.ToList());
                        if (rworkStepOutDto.MultimediaElectricalConnect.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "multimediaElectricalConnect";
                            table.TableName = "电连接器插接多媒体记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.MultimediaElectricalConnect.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                    d.SecondPhotoNo = GetPictureRouteNew(d.SecondPhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                    d.ThirdPhotoNo = GetPictureRouteNew(d.ThirdPhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                    d.FourthPhotoNo = GetPictureRouteNew(d.FourthPhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                    d.SecondPhotoNo = GetPictureRoute(d.SecondPhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                    d.ThirdPhotoNo = GetPictureRoute(d.ThirdPhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                    d.FourthPhotoNo = GetPictureRoute(d.FourthPhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("仪器安装电缆余量多媒体记录表"))
                    {
                        if (reachTable == "仪器安装电缆余量多媒体记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "仪器安装电缆余量多媒体记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.InstrumentCableAllowance = ObjectMapper.Map<List<RinstrumentCableAllowanceDto>>(bopData.ToList());
                        if (rworkStepOutDto.InstrumentCableAllowance.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "instrumentCableAllowance";
                            table.TableName = "仪器安装电缆余量多媒体记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.InstrumentCableAllowance.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("仪器安装分离钢索多媒体记录表"))
                    {
                        if (reachTable == "仪器安装分离钢索多媒体记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "仪器安装分离钢索多媒体记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.InstrumentSeparationCable = ObjectMapper.Map<List<RinstrumentSeparationCableDto>>(bopData.ToList());
                        if (rworkStepOutDto.InstrumentSeparationCable.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "instrumentSeparationCable";
                            table.TableName = "仪器安装分离钢索多媒体记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.InstrumentSeparationCable.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("仪器安装分离力测试多媒体记录表"))
                    {
                        if (reachTable == "仪器安装分离力测试多媒体记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "仪器安装分离力测试多媒体记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.InstrumentSeparationForceTest = ObjectMapper.Map<List<RinstrumentSeparationForceTestDto>>(bopData.ToList());
                        if (rworkStepOutDto.InstrumentSeparationForceTest.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "instrumentSeparationForceTest";
                            table.TableName = "仪器安装分离力测试多媒体记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.InstrumentSeparationForceTest.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("仪器安装力矩记录表"))
                    {
                        if (reachTable == "仪器安装力矩记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "仪器安装力矩记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.InstrumentTorqueRecord = ObjectMapper.Map<List<RinstrumentTorqueRecordDto>>(bopData.ToList());
                        if (rworkStepOutDto.InstrumentTorqueRecord.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "instrumentTorqueRecord";
                            table.TableName = "仪器安装力矩记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.InstrumentTorqueRecord.ForEach(d =>
                            {
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                    if (tableNames.Contains("仪器插座安装多媒体记录表"))
                    {
                        if (reachTable == "仪器插座安装多媒体记录表")
                        {
                            pageRealIndex = pageIndex;
                        }
                        else
                        {
                            pageRealIndex = 1;
                        }
                        var bopData = tableData.Where(d => d.FormName == "仪器插座安装多媒体记录表");
                        int count = bopData.Count();
                        if (paging) bopData = bopData.Skip((pageRealIndex - 1) * pageSize).Take(pageSize);
                        rworkStepOutDto.MultimediaSheetSocket = ObjectMapper.Map<List<RmultimediaSheetSocketDto>>(bopData.ToList());
                        if (rworkStepOutDto.MultimediaSheetSocket.Count > 0)
                        {
                            RtableNameDictionary table = new RtableNameDictionary();
                            table.TableKey = "multimediaSheetSocket";
                            table.TableName = "仪器插座安装多媒体记录表";
                            table.FiledDesc = filedMap[table.TableName].filedValue;
                            table.FiledName = filedMap[table.TableName].filedKey;
                            rworkStepOutDto.MultimediaSheetSocket.ForEach(d =>
                            {
                                if (isExport)
                                {
                                    d.PhotoNo = GetPictureRouteNew(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                else
                                {
                                    d.PhotoNo = GetPictureRoute(d.PhotoNo, mapOperationName[d.RWorkStepEntityId], 0, paging, isExcel);
                                }
                                //if (isFt)
                                //{
                                //    d.FirstOperator = GetAnalysisOperator(d.FirstOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.SecondOperator = GetAnalysisOperator(d.SecondOperator, mapOperationName[d.RWorkStepEntityId]);
                                //    d.ThirdOperator = GetAnalysisOperator(d.ThirdOperator, mapOperationName[d.RWorkStepEntityId]);
                                //}
                                //else
                                //{
                                d.FirstOperator = GetOperatorUserName(d.FirstOperator);
                                d.SecondOperator = GetOperatorUserName(d.SecondOperator);
                                d.ThirdOperator = GetOperatorUserName(d.ThirdOperator);
                                //}
                                if (DisplayRoute)
                                {
                                    d.Route = mapRoute[d.RWorkStepEntityId];
                                }
                            });
                            if (DisplayRoute)
                            {
                                table.FiledName.Add("路径");
                                table.FiledDesc.Add("route");
                            }
                            table.totalCount = count;
                            tableNameDictionary.Add(table);
                        }
                    }
                }
            }
            workStepAndProcessDto.WorkStepOut = rworkStepOutDto;

            workStepAndProcessDto.TableNameDictionary = tableNameDictionary;

            StaticOperation.pQualitWorkStepDto = workStepAndProcessDto;
            return workStepAndProcessDto;
        }

        /// <summary>
        /// 根据工步Guid获取工步路径
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetRouteStr(Guid id)
        {
            var curentWorkStep = _rworkStepEntity.Get(id);
            var workingProcedure = ""; //工序-工步
            //string nodeDrawingNoStr = "";
            if (curentWorkStep != null)
            {
                workingProcedure = "工步" + _rprocessesEntity.Get(curentWorkStep.RProcessesEntityId).ProcessesSequence.ToString() + "-" + curentWorkStep.WorkStepNumber.ToString();

                var TechniqueEntityName = _rtechniqueEntity.Get(curentWorkStep.RTechniqueEntityId).TechniqueName;

                workingProcedure = TechniqueEntityName + "-" + workingProcedure;
                //  var bopNode = _rBopNodeRepository.GetAll().Where(d => d.TechniqueEntityId == TechniqueEntityId).First();
                // GetParentsName(bopNode, ref nodeDrawingNoStr);
            }
            return workingProcedure;
        }

        private void GetParentsName(RbopNode node, ref string nodeDrawingNoStr)
        {
            nodeDrawingNoStr = node.NodeDrawingNo + "/" + nodeDrawingNoStr;
            if (node.ParentCode != "root")
            {
                var parentNode = _rBopNodeRepository.GetAll().Where(d => d.NodeCode == node.ParentCode).First();
                //递归
                GetParentsName(parentNode, ref nodeDrawingNoStr);
            }
        }
        /// <summary>
        /// 项目模糊查询
        /// </summary>
        /// <param name="recordElementStr"></param>
        /// <returns></returns>
        public List<String> GetRecordElementList(string recordElementStr)
        {
            if (string.IsNullOrEmpty(recordElementStr))
            {
                return _rTableBaseEntity.GetAll().Select(d => d.RecordElement).Distinct().Where(d => d != null).ToList();
            }
            else
            {
                return _rTableBaseEntity.GetAll().Where(d => d.RecordElement.Contains(recordElementStr)).Select(d => d.RecordElement).Distinct().Where(d => d != null).ToList();
            }

        }
        /// <summary>
        /// 部位模糊查询
        /// </summary>
        /// <param name="recordElementStr"></param>
        /// <returns></returns>
        public List<String> GetRecordLocationList(string recordLocationStr)
        {
            if (string.IsNullOrEmpty(recordLocationStr))
            {
                return _rRecordRequirementsEntity.GetAll().Select(d => d.RecordLocation).Distinct().Where(d => d != null).ToList();
            }
            else
            {
                return _rRecordRequirementsEntity.GetAll().Where(d => d.RecordLocation.Contains(recordLocationStr)).Select(d => d.RecordLocation).Distinct().Where(d => d != null).ToList();
            }

        }

        /// <summary>
        /// 多媒体查询接口 
        /// </summary>
        /// <param name="model">型号</param>
        /// <param name="lotstr">发次</param>
        /// <param name="nodeId">节点Id</param>
        /// <param name="RecordElementStr">项目</param>
        /// <param name="RecordLocationStr">部位</param>
        /// <param name="FirstOperatorDataBegin">记录开始日期</param>
        /// <param name="FirstOperatorDataEnd">记录结束日期</param>
        /// <param name="ShowAll">node节点是否为空 true则 无需选中节点</param>
        ///  <param name="nodeLevel">节点层级 默认是节点 8为工序 9 为工步</param>
        /// <param name="pageIndex">查询的页数 </param>
        /// <param name="pageSize">每页显示的个数</param>
        /// <returns></returns>
        public MultiMediaReportDto MultiMediaReport(string model, string lotstr, Guid nodeId, string RecordElementStr, string RecordLocationStr, string FirstOperatorDataBegin, string FirstOperatorDataEnd, bool ShowAll, int nodeLevel, int pageIndex = 1, int pageSize = 5, List<string> lotstrList = null)
        {
            MultiMediaReportDto multiMediaReportDto = new MultiMediaReportDto();
            //表头
            RtableNameDictionary table = new RtableNameDictionary();
            table.TableKey = "multimediaRecord";
            table.TableName = "通用多媒体记录表";
            List<string> filedName = new List<string>();
            List<string> filedDesc = new List<string>();
            filedName.AddRange(new string[] { "序号", "型号", "发次", "规程编号", "名称", "项目", "部位", "拍照(摄像)", "照片（影像）编号", "记录人", "记录日期", "确认结果", "确认人" });
            filedDesc.AddRange(new string[] { "serialNum", "model", "lotNo", "techniqueNumber", "techniqueName", "fisrtDrawingNum", "recordLocation", "recordRequire", "photoNo", "firstOperator", "firstOperatorData", "firstConfirmResult", "secondOperator" });
            table.FiledDesc = filedDesc;
            table.FiledName = filedName;
            table.totalCount = 0;

            List<Guid> workStepList = new List<Guid>();
            List<RbopDesc> bopDescList = new List<RbopDesc>();

            if (lotstrList.Count == 0)
            {
                bopDescList = _rBopDescRepository.GetAll().Where(d => d.Model == model && d.LotNo == lotstr).ToList();
                if (bopDescList.Count > 1)
                {
                    throw new UserFriendlyException("查询多个匹配该型号与发次的火箭！");
                }
            }
            else
            {
                lotstrList.Add(lotstr);
                bopDescList = _rBopDescRepository.GetAll().Where(d => d.Model == model && lotstrList.Contains(d.LotNo)).ToList();
            }

            //var techniqueQuery = _rtechniqueEntity.GetAll();

            //if (!string.IsNullOrEmpty(lotstr))
            //{
            //    var lostArr = lotstr.Split(',').ToArray();
            //    techniqueQuery = techniqueQuery.Where(d => lostArr.Contains(d.LotNo));
            //}
            //if (!string.IsNullOrEmpty(model))
            //{
            //    techniqueQuery = techniqueQuery.Where(d => d.Model.Contains(model));
            //}
            if (ShowAll || lotstrList.Count > 0)
            {
                var techIds = (from cc in _rBopNodeRepository.GetAll()
                               join pp in bopDescList on cc.RbopDescId equals pp.Id
                               join tt in _rtechniqueEntity.GetAll().Where(s => s.ReturnStatus != "报废") on cc.RtechniqueEntityId equals tt.Id
                               where cc.RtechniqueEntityId != null
                               select cc.RtechniqueEntityId);
                if (techIds.Count() > 0)
                {
                    var workIds = (from cc in _rworkStepEntity.GetAll()
                                   join mm in techIds on cc.RTechniqueEntityId equals mm
                                   select cc.Id);
                    if (workIds.Count() > 0)
                    {
                        workStepList.AddRange(workIds);
                    }
                }
                //var realIds = techniqueQuery.Select(d => d.Id);
                //var processesQuery = _rprocessesEntity.GetAllIncluding(p => p.WorkStepEntities).Where(d => realIds.Contains(d.RTechniqueEntityId)).OrderBy(n => n.ProcessesSequence);
                //foreach (var item in processesQuery)
                //{
                //    workStepList.AddRange(item.WorkStepEntities.OrderBy(d => d.WorkStepNumber).Select(d => d.Id));
                //}
                //workStepList = workStepList.Distinct().ToList();
            }
            else if (nodeLevel == 8) //8工序
            {
                var returnStatus = (from tt in _rtechniqueEntity.GetAll()
                                    join ww in _rprocessesEntity.GetAll().Where(d => d.Id == nodeId)
                                    on tt.Id equals ww.RTechniqueEntityId
                                    select tt.ReturnStatus).ToString();
                if (returnStatus == "报废")
                {
                    throw new UserFriendlyException("该工艺规程已经报废");
                }
                workStepList = _rworkStepEntity.GetAll().Where(d => d.RProcessesEntityId == nodeId).Select(d => d.Id).ToList();
            }
            else if (nodeLevel == 9)// 9工步其他都是节点
            {
                var returnStatus = (from tt in _rtechniqueEntity.GetAll()
                                    join ww in _rworkStepEntity.GetAll().Where(d => d.Id == nodeId)
                                    on tt.Id equals ww.RTechniqueEntityId
                                    select tt.ReturnStatus).ToString();
                if (returnStatus == "报废")
                {
                    throw new UserFriendlyException("该工艺规程已经报废");
                }
                workStepList.Add(nodeId);
            }
            else
            {
                var query = _rBopNodeRepository.FirstOrDefault(d => d.Id == nodeId);
                if (query != null)
                {
                    //var techIds = _rBopNodeRepository.GetAll().Where(d => d.NodeCode.StartsWith(query.NodeCode) && d.RbopDescId == bopDescList.First().Id).Where(d => d.RtechniqueEntityId != null).Select(d => d.RtechniqueEntityId).ToList();
                    var techIds = (from bb in _rBopNodeRepository.GetAll().Where(d => d.NodeCode.StartsWith(query.NodeCode) && d.RbopDescId == bopDescList.First().Id).Where(d => d.RtechniqueEntityId != null)
                                   join tt in _rtechniqueEntity.GetAll().Where(s => s.ReturnStatus != "报废") on bb.RtechniqueEntityId equals tt.Id
                                   select bb.RtechniqueEntityId).ToList();
                    if (techIds.Count() > 0)
                    {
                        var workIds = (from cc in _rworkStepEntity.GetAll()
                                       join mm in techIds on cc.RTechniqueEntityId equals mm
                                       select cc.Id);
                        if (workIds.Count() > 0)
                        {
                            workStepList.AddRange(workIds);
                        }
                    }
                }
                //var query = _rBopNodeRepository.GetAll().Where(d => d.Id == nodeId);
                //if (query.Count() > 0 && techniqueQuery.Count() > 0)
                //{
                //    string code = query.Select(d => d.NodeCode).Distinct().ToList().First();
                //    var codeList = _rBopNodeRepository.GetAll().Where(d => d.NodeCode.StartsWith(code));
                //    //筛选符合条件的工艺Id集合
                //    var techniqueIds = codeList.Where(d => d.RtechniqueEntityId != null).Select(d => d.RtechniqueEntityId).Distinct().ToList();
                //    if (techniqueIds.Count > 0)
                //    {
                //        //var realIds = techniqueQuery.Where(d => techniqueIds.Contains(d.TechniqueEntityId)).Select(d => d.Id);
                //        var realIds = techniqueIds;
                //        var processesQuery = _rprocessesEntity.GetAllIncluding(p => p.WorkStepEntities).Where(d => realIds.Contains(d.RTechniqueEntityId)).OrderBy(n => n.ProcessesSequence);
                //        foreach (var item in processesQuery)
                //        {
                //            workStepList.AddRange(item.WorkStepEntities.OrderBy(d => d.WorkStepNumber).Select(d => d.Id));
                //        }
                //        workStepList = workStepList.Distinct().ToList();
                //    }
                //}
            }

            if (workStepList.Count > 0)
            {

                DateTime? sDate = null, eDate = null;

                var tableData = _rTableBaseEntity.GetAllIncluding(a => a.RecordRequirements, b => b.InspectionSignature, c => c.MeasuredResult, d => d.Environment, e => e.MultiMedia).Where(p => workStepList.Contains(p.RWorkStepEntityId)).Where(d => d.FormName == "通用多媒体记录表");
                //筛选条件
                if (!string.IsNullOrEmpty(RecordElementStr))
                {
                    tableData = tableData.Where(d => d.RecordElement.Contains(RecordElementStr));
                }
                if (!string.IsNullOrEmpty(RecordLocationStr))
                {
                    tableData = tableData.Where(d => d.RecordRequirements.RecordLocation.Contains(RecordLocationStr));
                }
                if (!string.IsNullOrEmpty(FirstOperatorDataBegin))
                {
                    sDate = Convert.ToDateTime(FirstOperatorDataBegin);
                    tableData = tableData.Where(d => d.InspectionSignature.FirstOperatorData > sDate);
                }
                if (!string.IsNullOrEmpty(FirstOperatorDataEnd))
                {
                    eDate = Convert.ToDateTime(FirstOperatorDataEnd);
                    DateTime dtnew = new DateTime(eDate.Value.Year, eDate.Value.Month, eDate.Value.Day);
                    eDate = dtnew.AddDays(1).AddSeconds(-1);
                    tableData = tableData.Where(d => d.InspectionSignature.FirstOperatorData < eDate);
                }
                if (tableData.Count() > 0)
                {
                    var bopData = tableData.AsNoTracking();
                    table.totalCount = bopData.Count();
                    bopData = bopData.Skip((pageIndex - 1) * pageSize).Take(pageSize);
                    multiMediaReportDto.MultiMediaExport = ObjectMapper.Map<List<MultiMediaExportDto>>(bopData);
                    multiMediaReportDto.MultiMediaExport.ForEach(d =>
                    {
                        var techId = _rprocessesEntity.GetAll().Where(c => c.Id == d.RProcessesEntityId).First().RTechniqueEntityId;
                        var tech = _rtechniqueEntity.Get(techId);
                        d.Model = tech.Model;
                        d.LotNo = tech.LotNo;
                        d.TechniqueNumber = tech.TechniqueNumber;
                        d.TechniqueName = tech.TechniqueName;
                        d.PhotoNo = GetPictureRoute(d.PhotoNo, d.TechniqueNumber, 0);
                        d.FirstOperator = GetAnalysisOperator(d.FirstOperator);
                        d.SecondOperator = GetAnalysisOperator(d.SecondOperator);
                    });
                    multiMediaReportDto.MultiMediaExport = multiMediaReportDto.MultiMediaExport.OrderBy(n => n.FisrtDrawingNum).ThenBy(u => u.RecordLocation).ThenBy(u => u.LotNo).ToList();
                }
            }
            multiMediaReportDto.TableNameDictionary = table;
            return multiMediaReportDto;
        }
        /// <summary>
        ///  导出汇总表Excel
        /// </summary>
        /// <param name="model">型号</param>
        /// <param name="lotstr">发次</param>
        /// <param name="nodeId">节点Id</param>
        /// <param name="tableNameStr">多表名称 以逗号隔开</param>
        /// <param name="FisrtDrawingNum">图号/代号</param>
        /// <param name="FirstDrawingName">图号名称</param>
        /// <param name="SecondDrawingNum">零件2代号</param>
        /// <param name="SecondDrawingName">零件2名称</param>
        /// <param name="ToolUsed">所用工具编号</param>
        /// <param name="RecordElementStr">记录项目</param>
        /// <param name="ShowAll">node节点是否为空 true则 无需选中节点</param>
        ///  <param name="nodeLevel">节点层级 默认是节点 8为工序 9 为工步</param>
        /// <returns></returns>
        public string ExportReportExcel(string model, string lotstr, Guid? nodeId, string tableNameStr, string FisrtDrawingNum, string FirstDrawingName, string SecondDrawingNum, string SecondDrawingName, string ToolUsed, string RecordElementStr, bool ShowAll, int nodeLevel, bool envelope = false, List<string> lotstrList = null, bool isFt = true)
        {
            BopQualityExportAppService service = new BopQualityExportAppService(_tempFileCacheManager);
            var nodeName = "";
            if (nodeId != null)
            {
                var node = _rBopNodeRepository.FirstOrDefault(s => s.Id == nodeId);
                if (node != null)
                {
                    nodeName = node.NodeName;
                }
            }
            return service.QualityExportToFile(StatisticalReport(model, lotstr, nodeId, tableNameStr, FisrtDrawingNum, FirstDrawingName, SecondDrawingNum, SecondDrawingName, ToolUsed, RecordElementStr, ShowAll, true, nodeLevel, "", false, 1, 10, false, lotstrList, true, true, isFt), envelope, isFt, nodeName);

        }
        /// <summary>
        /// 拼接图片完整路径 type为0是多媒体 为1是签署表
        /// </summary>
        /// <param name="picstr"></param>
        /// <param name="operationName"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        private string GetPictureRoute(string picstr, string operationName, int type, bool isPaging = true, bool isExcel = false)
        {
            //处理多媒体图片的算法  存在格式 有jpeg  mp4
            if (isPaging == false && isExcel == false)
            {
                return picstr;
            }

            string url = ConfigHelper.GetAppSetting("App", "GetAppUrl") + "/UploadFile/";
            string newStr = "";
            if (!string.IsNullOrEmpty(picstr))
            {
                string distantRoute = "";
                var fileArr = picstr.Split(',');
                if (fileArr[0] == "否")
                {
                    return "否";
                }
                if (fileArr[0] == "是" && fileArr.Length == 1)
                {
                    return "";
                }
                else
                {
                    newStr = picstr.Replace("是", "");
                    fileArr = newStr.Split(',');
                }
                foreach (var item in fileArr)
                {
                    if (string.IsNullOrEmpty(item))
                    {
                        continue;
                    }
                    if (type == 0)
                    {

                        if (item.LastIndexOf("jpeg") != -1 || item.LastIndexOf("jpg") != -1)
                        {
                            string frontStr = "";
                            if (item.LastIndexOf("jpg") != -1)
                            {
                                frontStr = item.Replace(".jpg", "");
                                distantRoute = distantRoute + "," + url + operationName + @"/picture/" + frontStr + "_thumbnail.jpg";
                            }
                            else
                            {
                                frontStr = item.Replace(".jpeg", "");
                                distantRoute = distantRoute + "," + url + operationName + @"/picture/" + frontStr + "_thumbnail.jpeg";
                            }
                        }
                        else
                        {
                            distantRoute = distantRoute + "," + url + operationName + @"/video/" + item;
                        }

                    }
                    else
                    {
                        distantRoute = distantRoute + "," + url + operationName + @"/signature/" + item;
                    }
                }
                return distantRoute.Substring(1, distantRoute.Length - 1);
            }
            else
            {
                return "";
            }

        }
        private string GetPictureRouteNew(string picstr, string operationName, int type, bool isPaging = true, bool isExcel = false)
        {
            //处理多媒体图片的算法  存在格式 有jpeg  mp4
            if (isPaging == false && isExcel == false)
            {
                return picstr;
            }
            string newStr = "";
            string url = ConfigHelper.GetAppSetting("App", "GetAppUrl") + "/UploadFile/";
            if (!string.IsNullOrEmpty(picstr))
            {
                string distantRoute = "";
                var fileArr = picstr.Split(',');
                if (fileArr[0] == "否")
                {
                    return "否";
                }
                if (fileArr[0] == "是" && fileArr.Length == 1)
                {
                    return "";
                }
                else
                {
                    newStr = picstr.Replace("是", "");
                    fileArr = newStr.Split(',');
                }
                foreach (var item in fileArr)
                {
                    if (type == 0)
                    {

                        if (item.LastIndexOf("jpeg") != -1 || item.LastIndexOf("jpg") != -1)
                        {
                            string frontStr = "";
                            if (item.LastIndexOf("jpg") != -1)
                            {
                                frontStr = item.Replace(".jpg", "");
                                distantRoute = distantRoute + "," + url + operationName + @"/picture/" + frontStr + ".jpg";
                            }
                            else
                            {
                                frontStr = item.Replace(".jpeg", "");
                                distantRoute = distantRoute + "," + url + operationName + @"/picture/" + frontStr + ".jpeg";
                            }

                        }
                        else
                        {
                            distantRoute = distantRoute + "," + url + operationName + @"/video/" + item;
                        }

                    }
                    else
                    {
                        distantRoute = distantRoute + "," + url + operationName + @"/signature/" + item;
                    }
                }
                return distantRoute.Substring(1, distantRoute.Length - 1);
            }
            else
            {
                return "";
            }

        }
        //处理签署数据
        private string GetAnalysisOperator(string jsonOperatorStr, string operationName = "")
        {
            if (string.IsNullOrEmpty(jsonOperatorStr))
            {
                return "";
            }
            if (jsonOperatorStr.Contains("user"))
            {
                var jsonOperatorList = JsonConvert.DeserializeObject<List<Operator>>(jsonOperatorStr);
                if (jsonOperatorList != null)
                {
                    if (jsonOperatorList.Count > 0)
                    {
                        List<string> tempList = new List<string>();
                        foreach (var item in jsonOperatorList)
                        {
                            DateTime dtDate;
                            string time = "";
                            if (DateTime.TryParse(item.date, out dtDate))
                            {
                                time = dtDate.ToShortDateString().ToString();
                            }
                            else
                            {
                                time = item.date;
                            }
                            // 前台组装数据 然后 http的加超链接
                            tempList.Add(item.user + "*" + time + "*" + GetPictureRoute(item.name, operationName, 1));
                        }
                        return string.Join("，", tempList);
                    }
                    else
                    {
                        return "";
                    }
                }
                else
                {
                    return "";
                }
            }
            else
            {
                return "";
            }
        }
        private string GetAnalysisMeasuredValuesOperator(string jsonOperatorStr)
        {

            if (string.IsNullOrEmpty(jsonOperatorStr))
            {
                return "";
            }
            if (jsonOperatorStr.Contains("fullname"))
            {
                var jsonOperatorTemp = JsonConvert.DeserializeObject<Bop.QualityDto.OperatorFirstMeasuredValues>(jsonOperatorStr);
                if (jsonOperatorTemp != null)
                {
                    return jsonOperatorTemp.fullname;
                }
                else
                {
                    return jsonOperatorStr;
                }
            }
            else
            {
                return "";
            }
        }


        private void InitFiledMap(Dictionary<string, FiledMap> filedMap)
        {
            filedMap.Add("装入件明细", new FiledMap(new List<string> { "代号", "名称", "数量", "备注" }, new List<string> { "code", "name", "number", "remark" }));
            filedMap.Add("制造资源", new FiledMap(new List<string> { "类型", "ERPID", "代号或规格", "名称", "备注", "鉴定类别", "标准号", "是否必选" }, new List<string> { "type", "erpId", "specsCode", "name", "remark", "identifyType", "standardNumber", "isRequired" }));
            filedMap.Add("视频", new FiledMap(new List<string> { "视频文件", "文件名" }, new List<string> { "videoFile", "fileName" }));
            filedMap.Add("通用总装数据记录表", new FiledMap(
                new List<string> { "序号", "名称", "项目", "设计要求", "工艺要求", "实测值", "所用工具编号", "温度", "湿度", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
                new List<string> { "serialNum", "firstDrawingName", "recordElement", "designerDemand", "processorDemand", "firstMeasuredValues", "toolUsed", "temperature", "humidity", "remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
            ));
            filedMap.Add("通用记录表", new FiledMap(
               new List<string> { "序号", "图号", "名称", "记录项目", "记录要求", "实测值", "确认结果", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
               new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "recordElement", "recordRequire", "firstMeasuredValues", "firstConfirmResult", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
           ));
            filedMap.Add("胶液配比情况记录表", new FiledMap(
               new List<string> { "序号", "胶液名称", "记录元素", "实际情况", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
               new List<string> { "serialNum", "firstDrawingName", "recordItem", "measuredActual", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
           ));
            filedMap.Add("舱口盖开闭记录表", new FiledMap(
              new List<string> { "序号", "图号", "壳段名称", "产品编号", "舱口盖位置或象限", "打开/关闭", "实测力矩", "所用力矩扳手编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
              new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "productNum", "recordLocation", "recordItem", "firstMeasuredValues", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("进箱舱登记表", new FiledMap(
             new List<string> { "序号", "型号", "图号", "名称", "工作事项", "进箱时间", "进箱携带物品", "携带物品数量", "出箱确认", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "现场备注" },
             new List<string> { "serialNum", "model", "fisrtDrawingNum", "firstDrawingName", "recordStatus", "remarks", "recordRequire", "recordMainopoint", "firstConfirmResult", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "recordRemark" }
           ));
            filedMap.Add("具有证明书的主要零件记录表", new FiledMap(
              new List<string> { "序号", "图号", "名称", "零件编号", "合格证号编号", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
              new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "secondDrawingNum", "certificate", "remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
           ));
            filedMap.Add("力矩记录表", new FiledMap(
              new List<string> { "序号", "零件1", "零件2", "设计要求_拧紧值N.m", "工艺要求_拧紧值N.m", "实测值N.m", "所用工具编号", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
              new List<string> { "serialNum", "fisrtDrawingNum", "secondDrawingNum", "designerDemand", "processorDemand", "firstMeasuredValues", "toolUsed", "remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
           ));
            filedMap.Add("通用多媒体记录表", new FiledMap(
              new List<string> { "序号", "项目", "部位", "拍照(摄像)", "拍照(影像)编号", "确认结果", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "现场备注" },
              new List<string> { "serialNum", "fisrtDrawingNum", "recordLocation", "recordRequire", "photoNo", "firstConfirmResult", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "recordRemark" }
           ));
            filedMap.Add("通用力矩复校记录表", new FiledMap(
              new List<string> { "序号", "零件1", "零件2", "复测力矩N.m", "工艺力矩N.m", "恢复力矩N.m", "力矩扳手编号", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
              new List<string> { "serialNum", "fisrtDrawingNum", "secondDrawingNum", "firstMeasuredValues", "processorDemand", "secondMeasuredValues", "toolUsed", "remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
           ));
            filedMap.Add("质量控制记录表", new FiledMap(
                new List<string> { "项目", "操作者", "操作者日期", "互检", "互检日期", "检验员", "检验员日期", "现场备注" },
                new List<string> { "serialNum", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("电缆插头防水防热记录表", new FiledMap(
             new List<string> { "序号", "电缆/仪器代号", "插头代号", "实施情况", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "备注", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "secondDrawingNum", "firstConfirmResult", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "remarks", "recordRemark" }
           ));
            filedMap.Add("波纹管变形记录表", new FiledMap(
            new List<string> { "序号", "波纹管", "所属管路", "管路编号", "装配初始压缩量方向", "允许值", "安装前", "安装后", "变形量", "所用工具编号", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "recordLocation", "fisrtDrawingNum", "productNum", "recordElement", "designerDemand", "firstMeasuredValues", "secondMeasuredValues", "thirdMeasuredValues", "toolUsed", "remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("电连接器插接记录表", new FiledMap(
            new List<string> { "序号", "所属仪器代号", "插头座代号", "插接照片", "防松照片", "防水照片", "防热照片", "操作者", "互检者", "检验员", "确认人", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "recordLocation", "photoNo", "secondPhotoNo", "thirdPhotoNo", "fourthPhotoNo", "firstOperator", "secondOperator", "thirdOperator", "fourthOperator", "recordRemark" }
          ));
            filedMap.Add("舱口盖开闭测试记录表", new FiledMap(
            new List<string> { "序号", "所属部段", "舱口盖名称", "记录位置", "是否能正常开关", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "备注", "现场备注" },
            new List<string> { "serialNum", "parentProductName", "firstDrawingName", "recordLocation", "firstConfirmResult", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "remarks", "recordRemark" }
          ));
            filedMap.Add("产品接地状态检查记录表", new FiledMap(
            new List<string> { "序号", "图号", "名称", "编号", "接地状态", "产品端搭接电阻（mΩ）", "等电位端搭接电阻（mΩ）", "所用仪器编号", "温度", "湿度", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "productNum", "firstConfirmResult", "firstMeasuredValues", "secondMeasuredValues", "toolUsed", "temperature", "humidity", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("强制检验点记录表", new FiledMap(
            new List<string> { "序号", "项目", "设计要求", "实测结果", "是否合格", "照片编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "工艺员", "工艺员操作时间", "设计员", "设计员操作时间", "现场备注" },
            new List<string> { "serialNum", "recordElement", "designerDemand", "firstMeasuredValues", "firstConfirmResult", "photoNo", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "fourthOperator", "fourthOperatorData", "fifthOperator", "fifthOperatorData", "recordRemark" }
          ));
            filedMap.Add("自动关闭口盖检查记录表", new FiledMap(
            new List<string> { "序号", "口盖位置", "部段图号", "口盖名称", "检查确认项", "是否合格", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "firstDrawingName", "fisrtDrawingNum", "recordLocation", "recordItem", "firstConfirmResult", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("伺服机构工艺拉杆长度记录表", new FiledMap(
            new List<string> { "序号", "项目", "名称", "要求长度（mm）", "实测长度（mm）", "所用工具编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "recordElement", "firstDrawingName", "designerDemand", "firstMeasuredValues", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("状态检查表", new FiledMap(
            new List<string> { "序号", "确认项目", "确认结果", "部门", "确认者", "确认者操作时间", "现场备注" },
            new List<string> { "serialNum", "recordElement", "firstConfirmResult", "recordRequire", "firstOperator", "firstOperatorData", "recordRemark" }
          ));
            filedMap.Add("问题记录表", new FiledMap(
            new List<string> { "序号", "名称", "记录项目", "问题记录", "解决措施", "多媒体", "备注", "现场备注" },
            new List<string> { "serialNum", "firstDrawingName", "recordElement", "abnormalRecord", "measuredActual", "photoNo", "remarks", "recordRemark" }
          ));
            filedMap.Add("爆索尺寸测量记录表", new FiledMap(
            new List<string> { "序号", "总长（mm）", "记录位置", "扁平（mm）", "宽度（mm）", "所用仪器编号", "温度", "湿度", "现场备注" },
            new List<string> { "serialNum", "thirdMeasuredValues", "recordLocation", "firstMeasuredValues", "secondMeasuredValues", "toolUsed", "temperature", "humidity", "recordRemark" }
          ));
            filedMap.Add("整流罩星箭分离弹簧压缩数据记录表", new FiledMap(
           new List<string> { "序号", "所属部段", "安装位置", "零件编号", "弹簧自由长度H0（mm）", "弹簧的工作载荷P2（N）", "压缩后长度L要求", "压缩后弹簧总长（mm）", "所用工具编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
           new List<string> { "serialNum", "parentProductName", "recordLocation", "productNum", "firstMeasuredValues", "secondMeasuredValues", "thirdMeasuredValues", "fourthMeasuredValues", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("载荷支架组合体形位数据记录表", new FiledMap(
            new List<string> { "序号", "名称", "单位", "测量值", "所用工具编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "recordItem", "recordRequire", "firstMeasuredValues", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("设计签署总装数据记录表", new FiledMap(
            new List<string> { "序号", "名称", "项目", "设计要求", "工艺要求", "实测值", "所用工具编号", "温度", "湿度", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "设计员", "设计员操作时间", "现场备注" },
            new List<string> { "serialNum", "firstDrawingName", "recordElement", "designerDemand", "processorDemand", "firstMeasuredValues", "toolUsed", "Temperature", "Humidity", "Remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "fourthOperator", "fourthOperatorData", "recordRemark" }
          ));
            filedMap.Add("管路活门气密点检查记录表皂泡法", new FiledMap(
            new List<string> { "序号", "系统名称", "测点前管路图号", "测点后管路图号", "检查压力(MPa)", "检查方法", "设计要求值Pa*m3/s", "工艺要求值", "检查结果", "备注", "现场备注" },
            new List<string> { "serialNum", "parentProductNum", "fisrtDrawingNum", "secondDrawingNum", "recordRequire", "recordElement", "designerDemand", "processorDemand", "firstMeasuredValues", "remarks", "recordRemark" }
          ));
            filedMap.Add("管路活门气密点检查记录表氦质谱法", new FiledMap(
            new List<string> { "序号", "系统名称", "测点前管路图号", "测点后管路图号", "检查压力(MPa)", "检查方法", "设计要求值Pa*m3/s", "工艺要求值", "检查点输出Pa•m3/s", "检查点漏率Pa•m3/s", "所用工具编号", "比对漏孔漏率Pa•m3/s", "E6_比对装置输出Pa•m3/s", "大气本体Pa•m3/s", "温度", "湿度", "备注", "现场备注" },
            new List<string> { "serialNum", "parentProductNum", "fisrtDrawingNum", "secondDrawingNum", "recordRequire", "recordElement", "designerDemand", "processorDemand", "firstMeasuredValues", "secondMeasuredValues", "toolUsed", "thirdMeasuredValues", "fourthMeasuredValues", "atmPressure", "temperature", "humidity", "remarks", "recordRemark" }
          ));
            filedMap.Add("除了打保险防松外的总装直属件记录表", new FiledMap(
            new List<string> { "序号", "零件1", "零件2", "安装位置", "紧固件材料及规格", "拧紧力矩要求（N·m）", "实际力矩施加值", "防松方式", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "secondDrawingNum", "parentProductName", "recordMainopoint", "designerDemand", "firstMeasuredValues", "measuredActual", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("传感器安装测试记录情况统计记录表", new FiledMap(
            new List<string> { "序号", "图号", "名称", "状态", "传感器代号", "传感器名称", "参数代号", "导通检查点", "测试仪器1", "导通要求阻值", "实测阻值1", "绝缘检查点", "测试仪器2", "绝缘要求阻值", "实测阻值2", "所用数字三用表编号", "所用指针三用表编号", "所用温湿度计编号", "温度", "湿度", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "parentProductNum", "parentProductName", "recordStatus", "fisrtDrawingNum", "firstDrawingName", "recordLocation", "recordElement", "recordRequire", "designerDemand", "firstMeasuredValues", "recordItem", "recordMainopoint", "processorDemand", "secondMeasuredValues", "toolUsed", "secondToolUsed", "thirdToolUsed", "temperature", "humidity", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("插头状态检查表", new FiledMap(
            new List<string> { "序号", "所属仪器/支架", "参数代号", "产品状态", "检查状态", "检查结果", "多媒体", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "备注", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "recordLocation", "recordStatus", "recordRequire", "firstConfirmResult", "photoNo", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "remarks", "recordRemark" }
          ));
            filedMap.Add("惯组安装记录表一", new FiledMap(
            new List<string> { "序号", "图号", "记录点", "间隙值", "导电胶带层数", "所用赛尺编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "recordLocation", "firstMeasuredValues", "secondMeasuredValues", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("惯组安装记录表二", new FiledMap(
            new List<string> { "序号", "图号", "记录要求", "实测值", "所用赛尺编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "recordItem", "firstMeasuredValues", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("电缆高度测量记录表", new FiledMap(
            new List<string> { "序号", "电缆束位置", "中间框位置（自前端面）", "电缆高度（靠I象限）", "所用工具编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "recordLocation", "firstMeasuredValues", "secondMeasuredValues", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("电缆剥线试验记录表低频", new FiledMap(
            new List<string> { "序号", "导线编号", "剥线长度1精确到0.5mm", "检查导线绝缘层切除后的外观情况", "多媒体（两端皆要拍照）", "测量工具编号", "剥线钳编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "recordLocation", "firstMeasuredValues", "firstConfirmResult", "photoNo", "toolUsed", "secondToolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("压接实验测量记录表低频", new FiledMap(
            new List<string> { "序号", "图号", "记录要求", "设计要求", "实测值", "所用工具编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "recordItem", "designerDemand", "firstMeasuredValues", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("电缆剥线试验记录表高频", new FiledMap(
            new List<string> { "序号", "图号", "输出接口点号", "记录项目", "实测值", "检查结果", "多媒体", "剥线钳编号", "测量工具编号", "记录人", "记录人操作时间", "确认人", "确认人操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "recordLocation", "recordItem", "secondMeasuredValues", "firstConfirmResult", "photoNo", "secondToolUsed", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "recordRemark" }
          ));
            filedMap.Add("仪器接收检查记录表", new FiledMap(
            new List<string> { "序号", "所属仪器（支架）代号", "插头（座）代号", "外观检查", "电连接器检查", "合格证检查", "零件编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "recordLocation", "firstConfirmResult", "secondConfirmResult", "thirdConfirmResult", "firstMeasuredValues", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("电缆接收检查记录表", new FiledMap(
            new List<string> { "序号", "电缆代号", "参数代号", "整体外观良好、证件齐全", "插头（座）正常、代号一致、插针无歪斜", "减振垫检查", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "recordLocation", "fisrtDrawingNum", "firstConfirmResult", "secondConfirmResult", "thirdConfirmResult", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("箭地接口保护件检查记录表", new FiledMap(
            new List<string> { "序号", "安装位置", "堵盖规格/图号", "安装要求", "检查结果", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "recordLocation", "recordMainopoint", "recordRequire", "firstConfirmResult", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("通用检查记录表", new FiledMap(
            new List<string> { "序号", "项目", "位置", "记录项目", "检查结果", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "parentProductName", "recordLocation", "recordItem", "firstConfirmResult", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("对接面形位记录表", new FiledMap(
            new List<string> { "序号", "所属部段", "记录项目", "位置", "实测值", "所用工具编号", "温度", "湿度", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "parentProductName", "recordElement", "recordLocation", "firstMeasuredValues", "toolUsed", "temperature", "humidity", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("整流罩锉修记录表", new FiledMap(
            new List<string> { "序号", "图号", "锉修过的安装孔记录", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "measuredActual", "recordRemark" }
          ));

            filedMap.Add("整流罩安装后检查记录表", new FiledMap(
            new List<string> { "序号", "检查项目", "确认结果", "问题记录", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "firstDrawingName", "firstConfirmResult", "measuredActual", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("导管检查记录表", new FiledMap(
            new List<string> { "序号", "图号", "问题记录", "缺陷照片", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "设计员", "设计员操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "measuredActual", "photoNo", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "fourthOperator", "fourthOperatorData", "recordRemark" }
          ));
            filedMap.Add("管路上箭前吹除记录表", new FiledMap(
            new List<string> { "序号", "图号", "吹除压力/Mpa", "吹除时间/min", "吹除确认", "绸布照片", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "firstMeasuredValues", "secondMeasuredValues", "firstConfirmResult", "photoNo", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("气封管流量测试记录表", new FiledMap(
            new List<string> { "序号", "入口压力", "气源", "图号", "正向流量测量值", "正向流量校准值", "反向流量测量值", "反向流量校准值", "温度", "湿度", "所用工具编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "processorDemand", "recordRequire", "fisrtDrawingNum", "firstMeasuredValues", "secondMeasuredValues", "thirdMeasuredValues", "fourthMeasuredValues", "temperature", "humidity", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("阀门气瓶过滤器流量计输送管金属软管等检查记录表", new FiledMap(
            new List<string> { "序号", "图号", "名称", "零件编号", "检查状态", "检查项目", "检查结果", "缺陷照片", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "productNum", "recordStatus", "recordElement", "firstConfirmResult", "photoNo", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("单机安装位置记录表", new FiledMap(
            new List<string> { "序号", "阀门/过滤器", "安装位置", "零件编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "recordLocation", "productNum", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("安装距离记录表", new FiledMap(
            new List<string> { "序号", "记录项目", "记录位置", "安装要求", "图号", "实际安装测量值", "所用工具编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "recordElement", "recordLocation", "recordRequire", "fisrtDrawingNum", "firstMeasuredValues", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("小导管卡箍间距测量表", new FiledMap(
            new List<string> { "序号", "管路图号", "数量", "距离/mm", "多媒体", "所用工具编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "recordMainopoint", "firstMeasuredValues", "photoNo", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("未按要求施加力矩及未打保险防松记录表", new FiledMap(
            new List<string> { "序号", "记录项目", "安装位置", "紧固件材料及规格", "拧紧力矩要求N.m", "实际力矩施加情况", "未按要求施加力矩原因/防松方式", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "recordElement", "recordLocation", "recordMainopoint", "processorDemand", "firstMeasuredValues", "measuredActual", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("分解重装记录表", new FiledMap(
            new List<string> { "序号", "时间", "原因", "部位", "更换或返修情况", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "recordMainopoint", "recordRequire", "fisrtDrawingNum", "measuredActual", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("配合七零三绝热记录表", new FiledMap(
            new List<string> { "序号", "绝热部位", "位置", "数量", "是否完成", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "firstDrawingName", "parentProductName", "recordMainopoint", "firstConfirmResult", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("绝热去除记录表", new FiledMap(
            new List<string> { "序号", "所在部位", "局部去除要求", "实际去除情况照片", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "parentProductName", "recordRequire", "photoNo", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("连续拧紧环节力矩复校记录表", new FiledMap(
            new List<string> { "序号", "零件1", "工艺值1N.m", "复校值1N.m", "零件2", "工艺值2N.m", "复校值2N.m", "零件3", "所用工具编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "processorDemand", "firstMeasuredValues", "secondDrawingNum", "designerDemand", "secondMeasuredValues", "recordLocation", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("管路垫块安装情况记录表", new FiledMap(
            new List<string> { "序号", "管路图号", "卡箍位置", "垫块安装情况", "螺钉规格", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "fisrtDrawingNum", "recordLocation", "measuredActual", "recordMainopoint", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("箭体结构防水记录表", new FiledMap(
            new List<string> { "序号", "记录项目", "所属部段", "仪器代号", "操作要求", "确认结果", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
            new List<string> { "serialNum", "recordElement", "parentProductName", "fisrtDrawingNum", "designerDemand", "firstConfirmResult", "remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
          ));
            filedMap.Add("搭接线安装部位防水记录表", new FiledMap(
            new List<string> { "序号", "位置", "记录对象", "操作要求", "数量", "是否封堵", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "备注", "现场备注" },
            new List<string> { "serialNum", "parentProductName", "recordElement", "designerDemand", "firstMeasuredValues", "firstConfirmResult", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "remarks", "recordRemark" }
          ));
            filedMap.Add("总装零件称重记录表", new FiledMap(
             new List<string> { "序号", "图号", "产品名称", "数量", "单件质量(g)", "总质量（g）", "设备编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "recordRequire", "firstMeasuredValues", "secondMeasuredValues", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("总装耗材称重记录表", new FiledMap(
             new List<string> { "序号", "技术条件", "名称", "领取重量(g)", "剩余重量(g)", "丢弃重量(g)", "上箭重量(g)", "所用工具编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "firstMeasuredValues", "secondMeasuredValues", "thirdMeasuredValues", "fourthMeasuredValues", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("箭体称重记录表", new FiledMap(
             new List<string> { "序号", "所属部段", "记录项目", "记录要求", "实测值", "出厂/飞行状态", "温度", "湿度", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "parentProductName", "recordElement", "recordRequire", "firstMeasuredValues", "recordStatus", "temperature", "humidity", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("箭体称重时多装少装产品记录表", new FiledMap(
             new List<string> { "序号", "名称", "代号", "是否多装", "数量", "质量（Kg）", "现场备注" },
             new List<string> { "serialNum", "firstDrawingName", "fisrtDrawingNum", "firstConfirmResult", "firstMeasuredValues", "secondMeasuredValues", "recordRemark" }
             ));
            filedMap.Add("飞行质量质心设备调平数据记录表", new FiledMap(
             new List<string> { "序号", "记录项目", "传感器读数参考值", "传感器读数实际值", "现场备注" },
             new List<string> { "serialNum", "recordElement", "designerDemand", "firstMeasuredValues", "recordRemark" }
             ));
            filedMap.Add("飞行质量质心皮重及参数记录表", new FiledMap(
             new List<string> { "序号", "记录项目", "记录元素", "实测值", "现场备注" },
             new List<string> { "serialNum", "recordElement", "recordItem", "firstMeasuredValues", "recordRemark" }
             ));
            filedMap.Add("横向质心测量记录表", new FiledMap(
             new List<string> { "序号", "位置", "后支点称重", "后支点有效", "前支点称重", "前支点有效", "现场备注" },
             new List<string> { "serialNum", "recordLocation", "firstMeasuredValues", "secondMeasuredValues", "thirdMeasuredValues", "fourthMeasuredValues", "recordRemark" }
             ));
            filedMap.Add("大部段称重记录表", new FiledMap(
             new List<string> { "序号", "称重项目", "重量（Kg）", "所用工具编号", "温度", "湿度", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "recordElement", "firstMeasuredValues", "toolUsed", "temperature", "humidity", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("产品安装确认表", new FiledMap(
             new List<string> { "序号", "检查项目", "检查情况", "检查结果", "备注", "现场备注" },
             new List<string> { "serialNum", "recordElement", "processorDemand", "measuredActual", "remarks", "recordRemark" }
             ));
            filedMap.Add("阀门安装状态确认表", new FiledMap(
             new List<string> { "序号", "图号", "编号", "名称", "确认项目", "实际状态", "备注", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "productNum", "firstDrawingName", "recordElement", "firstConfirmResult", "remarks", "recordRemark" }
             ));
            filedMap.Add("通用接收检查记录表", new FiledMap(
             new List<string> { "序号", "记录项目", "记录要求", "检查结果", "多媒体", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "recordElement", "recordRequire", "measuredActual", "photoNo", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("通用保护件检查记录表", new FiledMap(
             new List<string> { "序号", "名称", "颜色", "数量", "安装位置", "检查情况", "问题记录", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "firstDrawingName", "recordStatus", "recordRequire", "recordLocation", "firstConfirmResult", "measuredActual", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("接口检查记录表", new FiledMap(
             new List<string> { "序号", "代号", "位置", "检查情况", "问题记录", "多媒体", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "recordLocation", "firstConfirmResult", "measuredActual", "photoNo", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("象限标识检查记录表", new FiledMap(
             new List<string> { "序号", "位置", "数量", "检查要求", "检查情况", "备注", "现场备注" },
             new List<string> { "serialNum", "recordLocation", "firstMeasuredValues", "recordRequire", "firstConfirmResult", "remarks", "recordRemark" }
             ));
            filedMap.Add("干燥剂检查记录表", new FiledMap(
             new List<string> { "序号", "记录项目", "干燥剂颜色", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "recordElement", "measuredActual", "remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("随大部段交付产品明细表", new FiledMap(
             new List<string> { "序号", "图号", "名称", "数量", "是否正常", "备注", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "designerDemand", "firstConfirmResult", "remarks", "recordRemark" }
             ));
            filedMap.Add("气瓶组充放气速率记录表", new FiledMap(
             new List<string> { "序号", "开始时间", "结束时间", "时间要求值", "结束实测值", "速率", "所用工具编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "firstMeasuredValues", "secondMeasuredValues", "designerDemand", "thirdMeasuredValues", "fourthMeasuredValues", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("系统保压记录表", new FiledMap(
             new List<string> { "序号", "检查部位", "检查状态", "压力要求值（MPa）", "压力实测值（MPa）", "压降要求值（MPa）", "压降实测值（MPa）", "温度", "湿度", "所用工具编号", "现场备注" },
             new List<string> { "serialNum", "firstDrawingName", "recordStatus", "designerDemand", "firstMeasuredValues", "recordRequire", "secondMeasuredValues", "temperature", "humidity", "toolUsed", "recordRemark" }
             ));
            filedMap.Add("气瓶压力测试记录表", new FiledMap(
             new List<string> { "序号", "气瓶名称", "设计要求值", "实测值", "所用工具编号", "备注", "现场备注" },
             new List<string> { "serialNum", "firstDrawingName", "designerDemand", "firstMeasuredValues", "toolUsed", "remarks", "recordRemark" }
             ));
            filedMap.Add("阀门使用次数记录表", new FiledMap(
             new List<string> { "序号", "名称/代号", "产品编号", "允许使用次数", "试验项目", "动作次数", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "productNum", "designerDemand", "recordStatus", "firstMeasuredValues", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("阀门测试记录表一", new FiledMap(
             new List<string> { "序号", "图号", "名称/代号", "测试项目", "测试要求", "产品编号", "测试状态", "实测值", "温度", "湿度", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "recordElement", "recordRequire", "productNum", "recordStatus", "firstMeasuredValues", "temperature", "humidity", "remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("气封流量测试记录表", new FiledMap(
             new List<string> { "序号", "检测位置", "要求流量（g/s）", "测量值", "校准后（m3/h）", "所用工具编号", "温度", "湿度", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "firstDrawingName", "designerDemand", "firstMeasuredValues", "thirdMeasuredValues", "toolUsed", "temperature", "humidity", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("阀门测试记录表二", new FiledMap(
             new List<string> { "序号", "图号", "名称/代号", "测试项目", "测试要求", "产品编号", "测试状态", "第一次", "第二次", "温度", "湿度", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "recordElement", "recordRequire", "productNum", "recordStatus", "firstMeasuredValues", "secondMeasuredValues", "temperature", "humidity", "remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("电磁阀尾罩检查表", new FiledMap(
             new List<string> { "序号", "图号", "参数代号", "箭上位置", "尾罩是否松动", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "recordRequire", "recordLocation", "firstConfirmResult", "remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("传感器变换器对应关系确认记录表", new FiledMap(
             new List<string> { "序号", "电缆束1", "变换器插头座", "变换器代号", "变换器编号", "电缆束2", "传感器插头座", "传感器代号", "传感器编号", "是否对应", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "parentProductNum", "fisrtDrawingNum", "recordLocation", "recordStatus", "parentProductName", "secondDrawingNum", "recordRequire", "recordMainopoint", "firstConfirmResult", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("产品安装数量记录表", new FiledMap(
             new List<string> { "序号", "项目", "使用数量", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "recordElement", "firstMeasuredValues", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));

            filedMap.Add("液位传感器尺寸协调记录表", new FiledMap(
             new List<string> { "序号", "测量项目", "理论值(mm)", "实测值(mm)", "误差(mm)", "所用工具编号", "温度", "湿度", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "recordElement", "designerDemand", "firstMeasuredValues", "secondMeasuredValues", "toolUsed", "temperature", "humidity", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("密封插头压接多媒体记录表", new FiledMap(
             new List<string> { "序号", "参数代号", "传感器代号", "箱内低温密封插头压接点", "输出接口点号", "插接照片", "备注", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "设计员", "设计员操作时间", "现场备注" },
             new List<string> { "serialNum", "parentProductNum", "fisrtDrawingNum", "recordLocation", "recordMainopoint", "photoNo", "remarks", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "fourthOperator", "fourthOperatorData", "recordRemark" }
             ));
            filedMap.Add("岗位分工表", new FiledMap(
             new List<string> { "序号", "岗位分工", "工作地点", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "确认人", "确认人操作时间", "现场备注" },
             new List<string> { "serialNum", "firstMeasuredValues", "measuredActual", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "fourthOperator", "fourthOperatorData", "recordRemark" }
             ));
            filedMap.Add("低频压接实验测量记录表", new FiledMap(
             new List<string> { "序号", "中间接头型", "拉脱力检查", "实测值1", "压接电阻检查", "实测值2", "抗电强度检查", "实测值3", "压接钳编号", "微欧计编号", "高阻表编号", "测力计编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "recordLocation", "recordRequire", "firstMeasuredValues", "recordStatus", "secondMeasuredValues", "recordMainopoint", "thirdMeasuredValues", "toolUsed", "secondToolUsed", "thirdToolUsed", "recordItem", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));

            filedMap.Add("高频压接点电阻及抗电强度检查记录表", new FiledMap(
             new List<string> { "序号", "编号", "外导体压接电阻要求", "实测值1(mΩ)", "内导体压接电阻要求", "实测值2(mΩ)", "内导体抗电强度检查", "实测值3(mΩ)", "压接钳编号", "微欧计编号", "高阻表编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "recordLocation", "recordRequire", "firstMeasuredValues", "recordStatus", "secondMeasuredValues", "recordMainopoint", "thirdMeasuredValues", "toolUsed", "secondToolUsed", "thirdToolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));

            filedMap.Add("高频压接点抗拉强度检查记录表", new FiledMap(
             new List<string> { "序号", "外导体拉脱要求", "实测值1(mΩ)", "内导体拉脱力要求", "实测值2", "拉脱力测试仪编号", "操作者", "操作者操作时间", "互检者", "互检者操作时间", "检验员", "检验员操作时间", "现场备注" },
             new List<string> { "serialNum", "recordRequire", "firstMeasuredValues", "recordStatus", "secondMeasuredValues", "toolUsed", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("电连接器插接多媒体记录表", new FiledMap(
             new List<string> { "序号", "零件1图号/代号", "所属部段名称", "产品编号", "参数代号", "照片1", "照片2", "照片3", "照片4", "操作者", "操作者日期", "互检", "互检日期", "检验员", "检验员日期", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "productNum", "paramCode", "photoNo", "secondPhotoNo", "thirdPhotoNo", "fourthPhotoNo", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("仪器安装电缆余量多媒体记录表", new FiledMap(
             new List<string> { "序号", "零件1图号/代号", "所属部段名称", "产品编号", "参数代号", "实测值1", "照片", "操作者", "操作者日期", "互检", "互检日期", "检验员", "检验员日期", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "productNum", "paramCode", "firstMeasuredValues", "photoNo", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("仪器安装分离钢索多媒体记录表", new FiledMap(
             new List<string> { "序号", "零件1图号/代号", "所属部段名称", "产品编号", "参数代号", "实测值1", "照片", "操作者", "操作者日期", "互检", "互检日期", "检验员", "检验员日期", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "productNum", "paramCode", "firstMeasuredValues", "photoNo", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("仪器安装分离力测试多媒体记录表", new FiledMap(
             new List<string> { "序号", "零件1图号/代号", "所属部段名称", "产品编号", "参数代号", "实测值1", "照片", "操作者", "操作者日期", "互检", "互检日期", "检验员", "检验员日期", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "productNum", "paramCode", "firstMeasuredValues", "photoNo", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("仪器安装力矩记录表", new FiledMap(
             new List<string> { "序号", "零件1图号/代号", "所属部段名称", "产品编号", "参数代号", "所用工具编号", "设计要求", "工艺要求", "备注", "实测值1", "操作者", "操作者日期", "互检", "互检日期", "检验员", "检验员日期", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "productNum", "paramCode", "toolUsed", "designerDemand", "processorDemand", "remarks", "firstMeasuredValues", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
            filedMap.Add("仪器插座安装多媒体记录表", new FiledMap(
             new List<string> { "序号", "零件1图号/代号", "所属部段名称", "产品编号", "参数代号", "实测值1", "照片", "操作者", "操作者日期", "互检", "互检日期", "检验员", "检验员日期", "现场备注" },
             new List<string> { "serialNum", "fisrtDrawingNum", "firstDrawingName", "productNum", "paramCode", "firstMeasuredValues", "photoNo", "firstOperator", "firstOperatorData", "secondOperator", "secondOperatorData", "thirdOperator", "thirdOperatorData", "recordRemark" }
             ));
        }
        /// <summary>
        /// 质量Bop部套描述窗口
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<RbopContentInfoDto> GetQualityBopContentInfoList(GetBopContentInfoInput input)
        {
            var bop = await _rBopNodeRepository.GetAll().FirstOrDefaultAsync(p => p.Id == input.NodeId);
            var bopContentInfo = new RbopContentInfoDto();
            if (bop != null)
            {
                var tech = await _rtechniqueEntity.FirstOrDefaultAsync(c => c.Id == bop.RtechniqueEntityId);

                if (bop != null)
                {
                    bopContentInfo.NodeDrawingNo = bop.NodeDrawingNo;
                    bopContentInfo.NodeName = bop.NodeName;
                    var rbopContents = _rbopContentRepository.FirstOrDefault(bopContentInfo.ContentId);
                    if (rbopContents != null)
                    {
                        bopContentInfo.ContentId = rbopContents.Id;
                        bopContentInfo.Remark = rbopContents.Remark;
                    }
                }
                if (tech != null)
                {
                    bopContentInfo.ProcessCode = bop.ProcessCode;
                    bopContentInfo.ProcessName = tech.TechniqueName;
                    bopContentInfo.NodeStageSign = tech.StageSign;
                    bopContentInfo.NodeStageSignDesc = ((StageSigns)tech.StageSign).ToString();
                    bopContentInfo.PadName = bop.PadName;
                    bopContentInfo.ExportDate = bop.ExportDate;
                    bopContentInfo.RelationDate = bop.RelationDate;
                    bopContentInfo.ReturnDate = bop.ReturnDate;
                    bopContentInfo.TechniqueExplain = tech.TechniqueExplain;
                }
            }
            return bopContentInfo;
        }

        /// <summary>
        ///  质量根据节点Id获取节点信息
        /// </summary>
        /// <param name="id">节点Id</param>
        /// <returns></returns>
        public async Task<RbopNodeDto> GetQualityBopNodeById(Guid id)
        {
            var bomNode = await _rBopNodeRepository.FirstOrDefaultAsync(x => x.Id == id);

            if (bomNode != null)
            {
                var bopNodeDto = ObjectMapper.Map<RbopNodeDto>(bomNode);
                return bopNodeDto;
            }
            else
            {
                return new RbopNodeDto();
            }
        }

        /// <summary>
        /// 获取重点工作
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public PagedResultDto<KeyWorkOutput> GetKeyWork(KeyWorkStepInput input)
        {

            // 根据 工序 或者 工步的签署属性来 获取数据 原则 工序 有这个属性 工步就不需要了 工序没有在筛选 工步的
            // 筛选条件也仅仅是质量表
            if (input.StartData != null)
            {
                input.StartData = Convert.ToDateTime(input.StartData.Value.ToShortDateString().ToString() + " " + "00:00:00");
            }
            if (input.EndData != null)
            {
                input.EndData = Convert.ToDateTime(input.EndData.Value.ToShortDateString().ToString() + " " + "23:59:59");
            }

            if (string.IsNullOrEmpty(input.ProcessesCharacteristic))
            {
                throw new UserFriendlyException("请选择查询属性！");
            }
            int count = 0;
            List<KeyWorkOutput> result = new List<KeyWorkOutput>();
            int route = GetNodeType(input.NodeId);
            switch (route)
            {
                case 1:
                    var techIdList = _rBopNodeRepository.GetAll().Where(d => d.RbopDescId == input.NodeId).Where(d => d.RtechniqueEntityId != null).Select(d => d.RtechniqueEntityId);
                    if (techIdList.Count() > 0)
                    {
                        var processList = (from temp in _rprocessesEntity.GetAll()
                                           join temp1 in techIdList.Distinct() on temp.RTechniqueEntityId equals temp1
                                           select new
                                           {
                                               Id = temp.Id,
                                               ProcessesName = temp.ProcessesName,
                                               ProcessesSequence = temp.ProcessesSequence,
                                               ProcessesCharacteristic = temp.ProcessesCharacteristic,
                                           });
                        if (processList.Count() > 0)
                        {
                            var checkPro = processList.Where(d => d.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic));
                            var noCheckPro = processList.Where(d => !d.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic));
                            //获取所有符合条件的工序下的工步集合
                            var chechWork = (from temp in _rworkStepEntity.GetAll()
                                             join temp1 in checkPro on temp.RProcessesEntityId equals temp1.Id
                                             join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                             join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                             select new KeyWorkOutput
                                             {
                                                 Id = temp.Id,
                                                 ProcessesName = temp1.ProcessesName,
                                                 ProcessesSequence = temp1.ProcessesSequence,
                                                 ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                                 ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                                 WorkStepNumber = temp.WorkStepNumber,
                                                 WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                                 WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                                 ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                                 TechniqueNumber = temp2.TechniqueNumber,
                                                 TechniqueName = temp2.ModuleName,
                                                 Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                             }).ToList();

                            if (chechWork.Count > 0)
                            {
                                result.AddRange(chechWork);
                            }

                            var tempQuery = (from temp in _rworkStepEntity.GetAll().Where(d => d.WorkStepCharacteristic.Contains(input.ProcessesCharacteristic))
                                             join temp1 in noCheckPro on temp.RProcessesEntityId equals temp1.Id
                                             join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                             join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                             select new KeyWorkOutput
                                             {
                                                 Id = temp.Id,
                                                 ProcessesName = temp1.ProcessesName,
                                                 ProcessesSequence = temp1.ProcessesSequence,
                                                 ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                                 ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                                 WorkStepNumber = temp.WorkStepNumber,
                                                 WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                                 WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                                 ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                                 TechniqueNumber = temp2.TechniqueNumber,
                                                 TechniqueName = temp2.ModuleName,
                                                 Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                             }).ToList();
                            if (tempQuery.Count > 0)
                            {
                                result.AddRange(tempQuery);
                            }
                        }
                    }
                    break;
                case 2:
                    var currentNode = _rBopNodeRepository.Get(input.NodeId);
                    var techIds = _rBopNodeRepository.GetAll().Where(d => d.RbopDescId == currentNode.RbopDescId && d.NodeCode.StartsWith(currentNode.NodeCode)).Where(d => d.RtechniqueEntityId != null).Select(d => d.RtechniqueEntityId);
                    if (techIds.Count() > 0)
                    {
                        var processList = (from temp in _rprocessesEntity.GetAll()
                                           join temp1 in techIds.Distinct() on temp.RTechniqueEntityId equals temp1
                                           select new
                                           {
                                               Id = temp.Id,
                                               ProcessesName = temp.ProcessesName,
                                               ProcessesSequence = temp.ProcessesSequence,
                                               ProcessesCharacteristic = temp.ProcessesCharacteristic,
                                           });
                        if (processList.Count() > 0)
                        {
                            var checkPro = processList.Where(d => d.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic));
                            var noCheckPro = processList.Where(d => !d.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic));
                            //获取所有符合条件的工序下的工步集合
                            var chechWork = (from temp in _rworkStepEntity.GetAll()
                                             join temp1 in checkPro on temp.RProcessesEntityId equals temp1.Id
                                             join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                             join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                             select new KeyWorkOutput
                                             {
                                                 Id = temp.Id,
                                                 ProcessesName = temp1.ProcessesName,
                                                 ProcessesSequence = temp1.ProcessesSequence,
                                                 ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                                 ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                                 WorkStepNumber = temp.WorkStepNumber,
                                                 WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                                 WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                                 ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                                 TechniqueNumber = temp2.TechniqueNumber,
                                                 TechniqueName = temp2.ModuleName,
                                                 Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                             }).ToList();

                            if (chechWork.Count > 0)
                            {
                                result.AddRange(chechWork);
                            }

                            var tempQuery = (from temp in _rworkStepEntity.GetAll().Where(d => d.WorkStepCharacteristic.Contains(input.ProcessesCharacteristic))
                                             join temp1 in noCheckPro on temp.RProcessesEntityId equals temp1.Id
                                             join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                             join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                             select new KeyWorkOutput
                                             {
                                                 Id = temp.Id,
                                                 ProcessesName = temp1.ProcessesName,
                                                 ProcessesSequence = temp1.ProcessesSequence,
                                                 ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                                 ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                                 WorkStepNumber = temp.WorkStepNumber,
                                                 WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                                 WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                                 ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                                 TechniqueNumber = temp2.TechniqueNumber,
                                                 TechniqueName = temp2.ModuleName,
                                                 Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                             }).ToList();
                            if (tempQuery.Count > 0)
                            {
                                result.AddRange(tempQuery);
                            }
                        }
                    }
                    break;
                case 3:
                    {
                        var bopNode = _rBopNodeRepository.Get(input.NodeId);
                        var processList = (from temp in _rprocessesEntity.GetAll().Where(d => d.RTechniqueEntityId == bopNode.RtechniqueEntityId)
                                           select new
                                           {
                                               Id = temp.Id,
                                               ProcessesName = temp.ProcessesName,
                                               ProcessesSequence = temp.ProcessesSequence,
                                               ProcessesCharacteristic = temp.ProcessesCharacteristic,
                                           });
                        if (processList.Count() > 0)
                        {
                            var checkPro = processList.Where(d => d.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic));
                            var noCheckPro = processList.Where(d => !d.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic));
                            //获取所有符合条件的工序下的工步集合
                            var chechWork = (from temp in _rworkStepEntity.GetAll()
                                             join temp1 in checkPro on temp.RProcessesEntityId equals temp1.Id
                                             join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                             join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                             select new KeyWorkOutput
                                             {
                                                 Id = temp.Id,
                                                 ProcessesName = temp1.ProcessesName,
                                                 ProcessesSequence = temp1.ProcessesSequence,
                                                 ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                                 ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                                 WorkStepNumber = temp.WorkStepNumber,
                                                 WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                                 WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                                 ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                                 TechniqueNumber = temp2.TechniqueNumber,
                                                 TechniqueName = temp2.ModuleName,
                                                 Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                             }).ToList();

                            if (chechWork.Count > 0)
                            {
                                result.AddRange(chechWork);
                            }

                            var tempQuery = (from temp in _rworkStepEntity.GetAll().Where(d => d.WorkStepCharacteristic.Contains(input.ProcessesCharacteristic))
                                             join temp1 in noCheckPro on temp.RProcessesEntityId equals temp1.Id
                                             join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                             join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                             select new KeyWorkOutput
                                             {
                                                 Id = temp.Id,
                                                 ProcessesName = temp1.ProcessesName,
                                                 ProcessesSequence = temp1.ProcessesSequence,
                                                 ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                                 ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                                 WorkStepNumber = temp.WorkStepNumber,
                                                 WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                                 WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                                 ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                                 TechniqueNumber = temp2.TechniqueNumber,
                                                 TechniqueName = temp2.ModuleName,
                                                 Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                             }).ToList();
                            if (tempQuery.Count > 0)
                            {
                                result.AddRange(tempQuery);
                            }
                        }
                    }
                    break;
                case 4:
                    var process = _rprocessesEntity.Get(input.NodeId);
                    if (process.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic))
                    {
                        var chechWork = (from temp in _rworkStepEntity.GetAll()
                                         join temp1 in _rprocessesEntity.GetAll().Where(d => d.Id == input.NodeId) on temp.RProcessesEntityId equals temp1.Id
                                         join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                         join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                         select new KeyWorkOutput
                                         {
                                             Id = temp.Id,
                                             ProcessesName = temp1.ProcessesName,
                                             ProcessesSequence = temp1.ProcessesSequence,
                                             ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                             ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                             WorkStepNumber = temp.WorkStepNumber,
                                             WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                             WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                             ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                             TechniqueNumber = temp2.TechniqueNumber,
                                             TechniqueName = temp2.ModuleName,
                                             Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                         }).ToList();

                        if (chechWork.Count > 0)
                        {
                            result.AddRange(chechWork);
                        }
                    }
                    break;
                default:
                    break;
            }
            if (result.Count > 0)
            {
                result = result.AsQueryable().WhereIf(input.StartData != null, d => d.ThirdOperatorData >= input.StartData).WhereIf(input.EndData != null, d => d.ThirdOperatorData <= input.EndData).ToList();
                count = result.Count;
                result = result.AsQueryable().PageBy(input).ToList();
            }
            return new PagedResultDto<KeyWorkOutput>(count, result);
        }

        /// <summary>
        /// 重点工作导出Excel
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public string ExportKeyWorkExcel(KeyWorkStepInput input)
        {
            BopQualityExportAppService service = new BopQualityExportAppService(_tempFileCacheManager);
            if (input.StartData != null)
            {
                input.StartData = Convert.ToDateTime(input.StartData.Value.ToShortDateString().ToString() + " " + "00:00:00");
            }
            if (input.EndData != null)
            {
                input.EndData = Convert.ToDateTime(input.EndData.Value.ToShortDateString().ToString() + " " + "23:59:59");
            }

            if (string.IsNullOrEmpty(input.ProcessesCharacteristic))
            {
                throw new UserFriendlyException("请选择查询属性！");
            }
            int count = 0;
            List<KeyWorkOutput> result = new List<KeyWorkOutput>();
            int route = GetNodeType(input.NodeId);
            switch (route)
            {
                case 1:
                    var techIdList = _rBopNodeRepository.GetAll().Where(d => d.RbopDescId == input.NodeId).Where(d => d.RtechniqueEntityId != null).Select(d => d.RtechniqueEntityId);
                    if (techIdList.Count() > 0)
                    {
                        var processList = (from temp in _rprocessesEntity.GetAll()
                                           join temp1 in techIdList.Distinct() on temp.RTechniqueEntityId equals temp1
                                           select new
                                           {
                                               Id = temp.Id,
                                               ProcessesName = temp.ProcessesName,
                                               ProcessesSequence = temp.ProcessesSequence,
                                               ProcessesCharacteristic = temp.ProcessesCharacteristic,
                                           });
                        if (processList.Count() > 0)
                        {
                            var checkPro = processList.Where(d => d.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic));
                            var noCheckPro = processList.Where(d => !d.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic));
                            //获取所有符合条件的工序下的工步集合
                            var chechWork = (from temp in _rworkStepEntity.GetAll()
                                             join temp1 in checkPro on temp.RProcessesEntityId equals temp1.Id
                                             join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                             join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                             select new KeyWorkOutput
                                             {
                                                 Id = temp.Id,
                                                 ProcessesName = temp1.ProcessesName,
                                                 ProcessesSequence = temp1.ProcessesSequence,
                                                 ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                                 ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                                 WorkStepNumber = temp.WorkStepNumber,
                                                 WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                                 WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                                 ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                                 TechniqueNumber = temp2.TechniqueNumber,
                                                 TechniqueName = temp2.ModuleName,
                                                 Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                             }).ToList();

                            if (chechWork.Count > 0)
                            {
                                result.AddRange(chechWork);
                            }

                            var tempQuery = (from temp in _rworkStepEntity.GetAll().Where(d => d.WorkStepCharacteristic.Contains(input.ProcessesCharacteristic))
                                             join temp1 in noCheckPro on temp.RProcessesEntityId equals temp1.Id
                                             join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                             join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                             select new KeyWorkOutput
                                             {
                                                 Id = temp.Id,
                                                 ProcessesName = temp1.ProcessesName,
                                                 ProcessesSequence = temp1.ProcessesSequence,
                                                 ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                                 ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                                 WorkStepNumber = temp.WorkStepNumber,
                                                 WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                                 WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                                 ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                                 TechniqueNumber = temp2.TechniqueNumber,
                                                 TechniqueName = temp2.ModuleName,
                                                 Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                             }).ToList();
                            if (tempQuery.Count > 0)
                            {
                                result.AddRange(tempQuery);
                            }
                        }
                    }
                    break;
                case 2:
                    var currentNode = _rBopNodeRepository.Get(input.NodeId);
                    var techIds = _rBopNodeRepository.GetAll().Where(d => d.RbopDescId == currentNode.RbopDescId && d.NodeCode.StartsWith(currentNode.NodeCode)).Where(d => d.RtechniqueEntityId != null).Select(d => d.RtechniqueEntityId);
                    if (techIds.Count() > 0)
                    {
                        var processList = (from temp in _rprocessesEntity.GetAll()
                                           join temp1 in techIds.Distinct() on temp.RTechniqueEntityId equals temp1
                                           select new
                                           {
                                               Id = temp.Id,
                                               ProcessesName = temp.ProcessesName,
                                               ProcessesSequence = temp.ProcessesSequence,
                                               ProcessesCharacteristic = temp.ProcessesCharacteristic,
                                           });
                        if (processList.Count() > 0)
                        {
                            var checkPro = processList.Where(d => d.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic));
                            var noCheckPro = processList.Where(d => !d.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic));
                            //获取所有符合条件的工序下的工步集合
                            var chechWork = (from temp in _rworkStepEntity.GetAll()
                                             join temp1 in checkPro on temp.RProcessesEntityId equals temp1.Id
                                             join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                             join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                             select new KeyWorkOutput
                                             {
                                                 Id = temp.Id,
                                                 ProcessesName = temp1.ProcessesName,
                                                 ProcessesSequence = temp1.ProcessesSequence,
                                                 ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                                 ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                                 WorkStepNumber = temp.WorkStepNumber,
                                                 WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                                 WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                                 ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                                 TechniqueNumber = temp2.TechniqueNumber,
                                                 TechniqueName = temp2.ModuleName,
                                                 Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                             }).ToList();

                            if (chechWork.Count > 0)
                            {
                                result.AddRange(chechWork);
                            }

                            var tempQuery = (from temp in _rworkStepEntity.GetAll().Where(d => d.WorkStepCharacteristic.Contains(input.ProcessesCharacteristic))
                                             join temp1 in noCheckPro on temp.RProcessesEntityId equals temp1.Id
                                             join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                             join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                             select new KeyWorkOutput
                                             {
                                                 Id = temp.Id,
                                                 ProcessesName = temp1.ProcessesName,
                                                 ProcessesSequence = temp1.ProcessesSequence,
                                                 ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                                 ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                                 WorkStepNumber = temp.WorkStepNumber,
                                                 WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                                 WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                                 ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                                 TechniqueNumber = temp2.TechniqueNumber,
                                                 TechniqueName = temp2.ModuleName,
                                                 Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                             }).ToList();
                            if (tempQuery.Count > 0)
                            {
                                result.AddRange(tempQuery);
                            }
                        }
                    }
                    break;
                case 3:
                    {
                        var bopNode = _rBopNodeRepository.Get(input.NodeId);
                        var processList = (from temp in _rprocessesEntity.GetAll().Where(d => d.RTechniqueEntityId == bopNode.RtechniqueEntityId)
                                           select new
                                           {
                                               Id = temp.Id,
                                               ProcessesName = temp.ProcessesName,
                                               ProcessesSequence = temp.ProcessesSequence,
                                               ProcessesCharacteristic = temp.ProcessesCharacteristic,
                                           });
                        if (processList.Count() > 0)
                        {
                            var checkPro = processList.Where(d => d.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic));
                            var noCheckPro = processList.Where(d => !d.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic));
                            //获取所有符合条件的工序下的工步集合
                            var chechWork = (from temp in _rworkStepEntity.GetAll()
                                             join temp1 in checkPro on temp.RProcessesEntityId equals temp1.Id
                                             join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                             join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                             select new KeyWorkOutput
                                             {
                                                 Id = temp.Id,
                                                 ProcessesName = temp1.ProcessesName,
                                                 ProcessesSequence = temp1.ProcessesSequence,
                                                 ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                                 ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                                 WorkStepNumber = temp.WorkStepNumber,
                                                 WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                                 WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                                 ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                                 TechniqueNumber = temp2.TechniqueNumber,
                                                 TechniqueName = temp2.ModuleName,
                                                 Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                             }).ToList();

                            if (chechWork.Count > 0)
                            {
                                result.AddRange(chechWork);
                            }

                            var tempQuery = (from temp in _rworkStepEntity.GetAll().Where(d => d.WorkStepCharacteristic.Contains(input.ProcessesCharacteristic))
                                             join temp1 in noCheckPro on temp.RProcessesEntityId equals temp1.Id
                                             join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                             join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                             select new KeyWorkOutput
                                             {
                                                 Id = temp.Id,
                                                 ProcessesName = temp1.ProcessesName,
                                                 ProcessesSequence = temp1.ProcessesSequence,
                                                 ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                                 ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                                 WorkStepNumber = temp.WorkStepNumber,
                                                 WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                                 WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                                 ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                                 TechniqueNumber = temp2.TechniqueNumber,
                                                 TechniqueName = temp2.ModuleName,
                                                 Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                             }).ToList();
                            if (tempQuery.Count > 0)
                            {
                                result.AddRange(tempQuery);
                            }
                        }
                    }
                    break;
                case 4:
                    var process = _rprocessesEntity.Get(input.NodeId);
                    if (process.ProcessesCharacteristic.Contains(input.ProcessesCharacteristic))
                    {
                        var chechWork = (from temp in _rworkStepEntity.GetAll()
                                         join temp1 in _rprocessesEntity.GetAll().Where(d => d.Id == input.NodeId) on temp.RProcessesEntityId equals temp1.Id
                                         join temp2 in _rtechniqueEntity.GetAll() on temp.RTechniqueEntityId equals temp2.Id
                                         join temp3 in _rTableBaseEntity.GetAllIncluding(d => d.InspectionSignature).Where(d => d.FormName == "质量控制记录表").Where(d => d.InspectionSignature.ThirdOperatorData != null) on temp.Id equals temp3.RWorkStepEntityId
                                         select new KeyWorkOutput
                                         {
                                             Id = temp.Id,
                                             ProcessesName = temp1.ProcessesName,
                                             ProcessesSequence = temp1.ProcessesSequence,
                                             ProcessesSequenceDesc = "工序" + temp1.ProcessesSequence.ToString(),
                                             ProcessesCharacteristic = temp1.ProcessesCharacteristic,
                                             WorkStepNumber = temp.WorkStepNumber,
                                             WorkStepNumberDesc = "工步" + temp.WorkStepNumber.ToString(),
                                             WorkStepCharacteristic = temp.WorkStepCharacteristic,
                                             ThirdOperatorData = temp3.InspectionSignature.ThirdOperatorData,
                                             TechniqueNumber = temp2.TechniqueNumber,
                                             TechniqueName = temp2.ModuleName,
                                             Route = "工序" + temp1.ProcessesSequence.ToString() + "-" + "工步" + temp.WorkStepNumber.ToString()
                                         }).ToList();

                        if (chechWork.Count > 0)
                        {
                            result.AddRange(chechWork);
                        }
                    }
                    break;
                default:
                    break;
            }
            return service.KeyWorkExportToFile(result);
        }

        /// <summary>
        /// 查找当前节点类型 1 任务-节点  2 节点-节点 3 节点-工序 4 工序-工步 5 工步
        /// </summary>
        /// <param name="ParentId"></param>
        /// <returns></returns>
        private int GetNodeType(Guid ParentId)
        {
            var bopDesc = _rBopDescRepository.GetAll().Where(d => d.Id == ParentId).FirstOrDefault();
            if (bopDesc != null)
            {
                return 1;
            }
            var bopNode = _rBopNodeRepository.GetAll().Where(d => d.Id == ParentId).FirstOrDefault();
            if (bopNode != null)
            {
                if (!string.IsNullOrEmpty(bopNode.ProcessCode))
                {
                    return 3;
                }
                else
                {
                    return 2;
                }
            }
            var processEntity = _rprocessesEntity.GetAll().Where(d => d.Id == ParentId).FirstOrDefault();
            if (processEntity != null)
            {
                return 4;
            }
            var workEntity = _rworkStepEntity.GetAll().Where(d => d.Id == ParentId).FirstOrDefault();
            if (workEntity != null)
            {
                return 5;
            }
            return 0;
        }

        #region 靶场
        //20221122
        private class ExportQShootingRangeBop
        {
            public RbopDesc rbopDesc { get; set; }

            public List<RbopNode> rbopNodes { get; set; } = new List<RbopNode>();

            public List<RTechniqueEntity> rTechniqueEntities { get; set; } = new List<RTechniqueEntity>();

            public List<RTableBase> rTableBases { get; set; } = new List<RTableBase>();

            public List<RLoadPieceEntity> RLoadPieceEntities { get; set; } = new List<RLoadPieceEntity>();

            public List<RMakeResourcesEntity> rMakeResourcesEntities { get; set; } = new List<RMakeResourcesEntity>();

            public List<RVideoEntity> rVideoEntities { get; set; } = new List<RVideoEntity>();
            //20221122
            /// <summary>
            /// 更改记录
            /// </summary>
            public List<EditFileProcess> _editFileList { get; set; } = new List<EditFileProcess>();
            /// <summary>
            /// 取消三检
            /// </summary>
            public List<ClearSignatureRecord> ClearSignatureRecord { get; set; } = new List<ClearSignatureRecord>();

        }

        private class InportQShootingRangeBop
        {
            public RbopDesc rbopDesc { get; set; }

            public List<RbopNode> rbopNodes { get; set; } = new List<RbopNode>();

            public List<RTechniqueEntity> rTechniqueEntities { get; set; } = new List<RTechniqueEntity>();

            public List<RTableBaseShootDto> rTableBases { get; set; } = new List<RTableBaseShootDto>();

            public List<RLoadPieceEntity> RLoadPieceEntities { get; set; } = new List<RLoadPieceEntity>();

            public List<RMakeResourcesEntity> rMakeResourcesEntities { get; set; } = new List<RMakeResourcesEntity>();

            public List<RVideoEntity> rVideoEntities { get; set; } = new List<RVideoEntity>();
            //20221122
            /// <summary>
            /// 更改记录
            /// </summary>
            public List<EditFileProcess> _editFileList { get; set; } = new List<EditFileProcess>();
            /// <summary>
            /// 取消三检
            /// </summary>
            public List<ClearSignatureRecord> ClearSignatureRecord { get; set; } = new List<ClearSignatureRecord>();
        }

        /// <summary>
        /// Bop靶场导出
        /// </summary>
        /// <param name="bopDescId"></param>
        /// <returns></returns>
        public ResultMessage GetrShootingRange(Guid bopDescId)
        {
            // 筛选 质量bop 的 工艺规程 工序 工步 关联表数据 打包json
            ResultMessage resultMessage = new ResultMessage();
            try
            {
                //bop导出
                ExportQShootingRangeBop shootingRangeBop = new ExportQShootingRangeBop();
                var bopDesc = _rBopDescRepository.GetAll().Where(d => d.Id == bopDescId).First();
                shootingRangeBop.rbopDesc = bopDesc;
                var bopNodeList = _rBopNodeRepository.GetAll().Where(d => d.RbopDescId == bopDescId);
                String DateStr = System.DateTime.Now.ToString("yyyyMMddHHmm");
                string bopePath = "../../Bop/rBopShootingRange/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/";
                if (bopNodeList.Count() > 0)
                {
                    shootingRangeBop.rbopNodes.AddRange(bopNodeList);
                    if (!Directory.Exists(bopePath))
                    {
                        Directory.CreateDirectory(bopePath);
                    }
                    string bopfp = bopePath + bopDesc.Model + "_" + bopDesc.LotNo + "_shootRBop.json"; 
                    if (File.Exists(bopfp))  // 判断是否已有相同文件 
                    {
                        File.Delete(bopfp);
                    }
                    JsonSerializer serializer = new JsonSerializer();
                    StreamWriter sw = new StreamWriter(bopfp, false);
                    serializer.Serialize(new JsonTextWriter(sw), shootingRangeBop);
                    sw.Flush();
                    sw.Close();

                    JsonSerializer serializerData = default;
                    StreamWriter swData = default;
                    ExportQShootingRangeBop shootingRangeBopExport;
                    //规程导出
                    var techEntity = (from cc in _rtechniqueEntity.GetAll().Include(d => d.ProcessesEntities).ThenInclude(d => d.WorkStepEntities)
                                join mm in bopNodeList on cc.Id equals mm.RtechniqueEntityId
                                select cc);

                    var processesEntity = (from cc in _rprocessesEntity.GetAll()
                                           join mm in techEntity on cc.RTechniqueEntityId equals mm.Id
                                           select cc).ToList();

                    var workStepEntity = (from cc in _rworkStepEntity.GetAll()
                                          join mm in techEntity on cc.RTechniqueEntityId equals mm.Id
                                          select cc).ToList();

                    var tablebaseErtity = (from cc in _rTableBaseEntity.GetAllIncluding(a => a.RecordRequirements, b => b.InspectionSignature, c => c.MeasuredResult, d => d.Environment, e => e.MultiMedia)
                                           join mm in workStepEntity on cc.RWorkStepEntityId equals mm.Id
                                           select cc).AsNoTracking().ToList();

                    var loadPiece = (from cc in _rLoadPieceRepository.GetAll()
                                     join mm in workStepEntity on cc.RWorkStepEntityId equals mm.Id
                                     select cc).ToList();

                    var makeResourcesEntity = (from cc in _rMakeResourcesEntityRepository.GetAll()
                                               join mm in workStepEntity on cc.RWorkStepEntityId equals mm.Id
                                               select cc).ToList();

                    var videoEntity = (from cc in _rVideoEntityRepository.GetAll()
                                       join mm in workStepEntity on cc.RWorkStepEntityId equals mm.Id
                                       select cc).ToList();
                    var clearSignatureRecord = (from cc in _clearSignatureRecordRepository.GetAll().Include(d => d.ClearSignatureRowDatas).Include(d => d.ClearSignatureDataStruces)
                               join mm in techEntity on cc.RTechniqueEntityId equals mm.Id
                               select cc).ToList();
     
   
                    var editFileProcess = (from cc in _editFileProcessRepository.GetAll().Include(d => d.EditFileProcessInfos).ThenInclude(a => a.EditFileStepInfos)
                                        .ThenInclude(c => c.EditFileTableInfos).ThenInclude(c => c.EditFileRowInfos).ThenInclude(d => d.EditFileTableDataInfos)
                                        .Include(d => d.EditFileProcessInfos).ThenInclude(a => a.EditFileStepInfos).ThenInclude(c => c.EditFileTableInfos)
                                        .ThenInclude(c => c.EditFileTableStructInfos)
                                        join mm in techEntity on cc.RTechniqueEntityId equals mm.Id
                                        select cc).ToList();

                    foreach (var item in bopNodeList)
                    {
                        shootingRangeBopExport = new ExportQShootingRangeBop();
                        var tech = (from cc in techEntity
                                    .Where(s=>s.Id == item.RtechniqueEntityId)
                                    select cc);
                        if (tech.Count() > 0)
                        {
                            var techNumber = tech.FirstOrDefault().TechniqueNumber;
                            shootingRangeBopExport.rTechniqueEntities.AddRange(tech);

                            var pro = (from cc in processesEntity
                                       join mm in tech on cc.RTechniqueEntityId equals mm.Id
                                       select cc);

                            var work = (from cc in workStepEntity
                                        join mm in tech on cc.RTechniqueEntityId equals mm.Id
                                        select cc);

                            var table = (from cc in tablebaseErtity
                                         join mm in work on cc.RWorkStepEntityId equals mm.Id
                                         select cc);
                            if (table.Count() > 0)
                            {
                                shootingRangeBopExport.rTableBases.AddRange(table);
                            }

                            var load = (from cc in loadPiece
                                        join mm in work on cc.RWorkStepEntityId equals mm.Id
                                        select cc);
                            if (load.Count() > 0)
                            {
                                shootingRangeBopExport.RLoadPieceEntities.AddRange(load);
                            }
                            var make = (from cc in makeResourcesEntity
                                        join mm in work on cc.RWorkStepEntityId equals mm.Id
                                        select cc);
                            if (make.Count() > 0)
                            {
                                shootingRangeBopExport.rMakeResourcesEntities.AddRange(make);
                            }

                            var video = (from cc in videoEntity
                                         join mm in work on cc.RWorkStepEntityId equals mm.Id
                                         select cc);
                            if (video.Count() > 0)
                            {
                                shootingRangeBopExport.rVideoEntities.AddRange(video);
                            }
                            //取消三检
                            var csr = (from cc in clearSignatureRecord
                                       join mm in tech on cc.RTechniqueEntityId equals mm.Id
                                       select cc).ToList();
                            shootingRangeBopExport.ClearSignatureRecord.AddRange(csr);
                            //更改记录
                            var editFileList = (from cc in editFileProcess
                                                join mm in tech on cc.RTechniqueEntityId equals mm.Id
                                                select cc).ToList();
                            shootingRangeBopExport._editFileList.AddRange(editFileList);
                            string path = "../../Bop/rBopShootingRange/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/" + techNumber + "/";
                            if (!Directory.Exists(path))
                            {
                                Directory.CreateDirectory(path);
                            }
                            string fp = path + techNumber + ".json"; //"_" +System.DateTime.Now.ToString("yyyyMMddHHmm")
                            if (File.Exists(fp))  // 判断是否已有相同文件 
                            {
                                File.Delete(fp);
                            }
                            serializerData = new JsonSerializer();
                            swData = new StreamWriter(fp, false);
                            serializerData.Serialize(new JsonTextWriter(swData), shootingRangeBopExport);
                            swData.Flush();

                            //string pathPhoto = "../../Bop/rBopShootingRange/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/" + techNumber + "/";
                            //if (!Directory.Exists(pathPhoto + "picture"))
                            //{
                            //    Directory.CreateDirectory(pathPhoto + "picture");
                            //}
                            //if (!Directory.Exists(pathPhoto + "signature"))
                            //{
                            //    Directory.CreateDirectory(pathPhoto + "signature");
                            //}
                            //if (!Directory.Exists(pathPhoto + "video"))
                            //{
                            //    Directory.CreateDirectory(pathPhoto + "video");
                            //}
                            //string srcPatch = Environment.CurrentDirectory + "/wwwroot/UploadFile/" + techNumber + "/";
                            //if (!Directory.Exists(srcPatch))
                            //{
                            //    Directory.CreateDirectory(srcPatch);
                            //}
                            //if (Directory.Exists(srcPatch + "picture"))
                            //{
                            //    if (!CopyDir(srcPatch + "picture", pathPhoto + "picture"))
                            //    {
                            //        resultMessage.code = 1;
                            //        resultMessage.Message = "复制文件文件失败!";
                            //        return resultMessage;
                            //    }
                            //}
                            //if (Directory.Exists(srcPatch + "signature"))
                            //{
                            //    if (!CopyDir(srcPatch + "signature", pathPhoto + "signature"))
                            //    {
                            //        resultMessage.code = 1;
                            //        resultMessage.Message = "复制文件文件失败!";
                            //        return resultMessage;
                            //    }
                            //}
                            //if (Directory.Exists(srcPatch + "video"))
                            //{
                            //    if (!CopyDir(srcPatch + "video", pathPhoto + "video"))
                            //    {
                            //        resultMessage.code = 1;
                            //        resultMessage.Message = "复制文件文件失败!";
                            //        return resultMessage;
                            //    }
                            //}
                        }
                    }
                    swData.Close();
                    swData.Dispose();
                    //GC.Collect();
                    string fileSavePath = Environment.CurrentDirectory + "/wwwroot/Zip/rBopShootingRange/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/";
                    if (!Directory.Exists(fileSavePath))
                    {
                        Directory.CreateDirectory(fileSavePath);
                    }
                    string zipTreeName = fileSavePath + bopDesc.Model + "_" + bopDesc.LotNo + "_shootRBop.zip";
                    if (File.Exists(zipTreeName))
                    {
                        File.Delete(zipTreeName);
                    }
                    //组装打包然后压缩
                    CompressMulti(new List<string> { bopePath }, zipTreeName, true);
                    //ZipFile.CreateFromDirectory(treePath, zipTreeName);
                    resultMessage.code = 0;
                    resultMessage.Message = ConfigHelper.GetAppSetting("App", "GetAppUrl") + "/Zip/rBopShootingRange/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "_shootRBop.zip";
                    //_iOperationHistoryAppService.InsertOperationLogNew(tempDesc.Id, OperationHistory.BusinessTypes.导出数据包, OperationHistory.OperationTypes.批量导出规程, "【v" + edtion.ToString() + "】" + resultMessage.Message);
                    return resultMessage;
                }
                resultMessage.code = 1;
                resultMessage.Message = "该任务下没有节点无法导出!";
                return resultMessage;
            }
            catch (Exception ex)
            {
                resultMessage.code = 1;
                resultMessage.Message = ex.Message;
                return resultMessage;
            }
        }

        [UnitOfWork(false)]
        public async Task<ResultMessage> rShootingBigRangeBop(string file)
        {
            ResultMessage resultMessage = new ResultMessage();
            string uniqueFileName = null;
            try
            {
                if (!string.IsNullOrEmpty(file))
                {
                    string rootPath = Environment.CurrentDirectory + "/wwwroot/";
                    string[] formatArray = { ".zip", ".7z" };
                    //文件格式
                    var fileExtension = Path.GetExtension(file);
                    if (!formatArray.Contains(fileExtension))
                    {

                        resultMessage.code = 1;
                        resultMessage.Message = "上传文件格式错误!";
                        return resultMessage;
                    }
                    //文件名称
                    var jsonName = file.Split('.')[0];
                    if (!jsonName.Contains("_shootRBop"))
                    {
                        resultMessage.code = 1;
                        resultMessage.Message = "上传文件不合法！";
                        return resultMessage;
                    }
                    string fileSaveBigRootDir = ConfigHelper.GetAppSetting("App", "BigFileRootPath");
                    //读取文件保存的根目录
                    string fileSaveRootDir = ConfigHelper.GetAppSetting("App", "rShootingRangePath");

                    //文件保存的路径(应用的工作目录+文件夹相对路径);
                    string fileSavePath = rootPath + fileSaveBigRootDir;
                    if (!Directory.Exists(fileSavePath))
                    {
                        Directory.CreateDirectory(fileSavePath);
                    }
                    //文件路径
                    string ZipPath = fileSavePath + "/" + file;
                    //目标路径
                    String DateStr = System.DateTime.Now.ToString("yyyyMMddHHmm");
                    string FilePath = Environment.CurrentDirectory + "/wwwroot/" + fileSaveRootDir + "/" + jsonName + "/" + DateStr;
                    //如果不需要嵌入到接口 去掉用exe解压
                    if (!ZipOpen(ZipPath, FilePath, true))
                    {
                        resultMessage.code = 1;
                        resultMessage.Message = "解压文件错误";
                        return resultMessage;
                    }

                    // string destinationDirectoryName = FilePath + "/" + jsonName + "/" + DateStr;
                    //  ZipFile.ExtractToDirectory(@filePath, destinationDirectoryName);
                    //ZipFile.ExtractToDirectory(@filePath, destinationDirectoryName);
                    List<InportQShootingRangeBop> inportQShootingRangeBops = new List<InportQShootingRangeBop>();
                    var directory = new DirectoryInfo(FilePath + "/");
                    var logFiles = directory.GetFiles("*.json", SearchOption.AllDirectories).ToList();
                    // List<Dto.TableReturnDto.Technique.BackTaskFormat> Tasks = new List<Dto.TableReturnDto.Technique.BackTaskFormat>();
                    for (int i = 0; i < logFiles.Count; i++)
                    {
                        var techName = logFiles[i].Name.Split('.')[0];
                        if (techName.Replace("_", "") != jsonName.Replace("_", ""))
                        {
                            Dto.TableReturnDto.Technique.BackTaskFormat backTask = new Dto.TableReturnDto.Technique.BackTaskFormat();
                            backTask.TechniqueNum = techName;

                            var jsonStr = ReadJson.GetFileJson(FilePath + "/" + techName + "/" + techName + ".json");
                            var ReturnBopTaskOutDto = JsonConvert.DeserializeObject<InportQShootingRangeBop>(jsonStr);
                            inportQShootingRangeBops.Add(ReturnBopTaskOutDto);
                            ////曲冰修改
                            //backTask.FilePath =;
                            // Tasks.Add(backTask);
                        }
                        else
                        {
                            var jsonStr = ReadJson.GetFileJson(logFiles[0].ToString());
                            var ReturnBopTaskOutDto = JsonConvert.DeserializeObject<InportQShootingRangeBop>(jsonStr);
                            inportQShootingRangeBops.Add(ReturnBopTaskOutDto);
                        }
                        
                    }
                    resultMessage = await DealShootData(inportQShootingRangeBops);
                    //var jsonStr = ReadJson.GetFileJson(FilePath + "/" + jsonName + ".json");
                    //var ReturnBopTaskOutDto = JsonConvert.DeserializeObject<InportQShootingRangeBop>(jsonStr);

                    //var resultData = await DealShootData(ReturnBopTaskOutDto);
                    if (resultMessage.code == 0)
                    {
                        //System.IO.File.Delete(ZipPath);
                        resultMessage.code = 0;
                        resultMessage.Message = jsonName + "上传成功!";
                        return resultMessage;
                    }
                    else
                    {
                        resultMessage.code = 1;
                        resultMessage.Message = resultMessage.Message;
                        return resultMessage;
                    }
                    ////获取传入文件的md5值
                    //var md = GetMD5HashFromFile(filePath);
                    ////判断上传的文件的md5是否相同
                    //if (md == md5)
                    //{

                    //}
                    //else
                    //{
                    //    resultMessage.code = 1;
                    //    resultMessage.Message = "Md5值不符,请重新上传";
                    //    return resultMessage;

                    //}

                }
                else
                {
                    resultMessage.code = 1;
                    resultMessage.Message = "文件不能为空";
                    return resultMessage;
                }
            }
            catch (Exception ex)
            {
                resultMessage.code = 1;
                resultMessage.Message = ex.Message;
                return resultMessage;
            }

        }

        private bool ZipOpen(string zipPath, string filePath, bool v)
        {
            try
            {
                StaticOperation.UnZip(zipPath, filePath, null, true);
                return true;
            }
            catch
            {
                return false;

            }
        }
        //[Microsoft.AspNetCore.Mvc.DisableRequestSizeLimit]
        //public async Task<ResultMessage> rShootingRangeBop(IFormFile file)
        //{
        //    ResultMessage resultMessage = new ResultMessage();
        //    string uniqueFileName = null;
        //    try
        //    {
        //        if (file != null)
        //        {
        //            string[] formatArray = { ".zip", ".7z" };
        //            //文件格式
        //            var fileExtension = Path.GetExtension(file.FileName);
        //            if (!formatArray.Contains(fileExtension))
        //            {

        //                resultMessage.code = 1;
        //                resultMessage.Message = "上传文件格式错误!";
        //                return resultMessage;
        //            }
        //            //文件名称
        //            var jsonName = file.FileName.Split('.')[0];
        //            if (!jsonName.Contains("_shootRBop"))
        //            {
        //                resultMessage.code = 1;
        //                resultMessage.Message = "上传文件不合法！";
        //                return resultMessage;
        //            }
        //            //读取文件保存的根目录
        //            string fileSaveRootDir = ConfigHelper.GetAppSetting("App", "rShootingRangePath");

        //            //文件保存的路径(应用的工作目录+文件夹相对路径);
        //            string fileSavePath = Environment.CurrentDirectory + "/wwwroot/" + fileSaveRootDir;
        //            if (!Directory.Exists(fileSavePath))
        //            {
        //                Directory.CreateDirectory(fileSavePath);
        //            }
        //            uniqueFileName = jsonName + fileExtension;
        //            string filePath = Path.Combine(fileSavePath, uniqueFileName);
        //            using (var fileStream = new FileStream(filePath, FileMode.Create))
        //            {
        //                file.CopyTo(fileStream);
        //                fileStream.Flush();
        //            }
        //            //获得当前文件夹名称
        //            var fileSave = uniqueFileName.Split('.')[0];

        //            String DateStr = System.DateTime.Now.ToString("yyyyMMddHHmm");
        //            if (!Directory.Exists(@fileSavePath + "/" + fileSave + "/" + DateStr))
        //            {
        //                Directory.CreateDirectory(@fileSavePath + "/" + fileSave + "/" + DateStr);
        //            }
        //            string destinationDirectoryName = @fileSavePath + "/" + fileSave + "/" + DateStr;
        //            ZipFile.ExtractToDirectory(@filePath, destinationDirectoryName);

        //            var directory = new DirectoryInfo(destinationDirectoryName + "/");
        //            var logFiles = directory.GetFiles("*.json", SearchOption.AllDirectories).ToList();

        //            // List<Dto.TableReturnDto.Technique.BackTaskFormat> Tasks = new List<Dto.TableReturnDto.Technique.BackTaskFormat>();
        //            for (int i = 0; i < logFiles.Count; i++)
        //            {
        //                var techName = logFiles[i].Name.Split('.')[0];
        //                if (techName.Replace("_", "") != jsonName.Replace("_", ""))
        //                {
        //                    Dto.TableReturnDto.Technique.BackTaskFormat backTask = new Dto.TableReturnDto.Technique.BackTaskFormat();
        //                    backTask.TechniqueNum = techName;

        //                    var jsonStr = ReadJson.GetFileJson(fileSavePath + "/" + jsonName + "/" + techName + "/" + techName + ".json");
        //                    var ReturnBopTaskOutDto = JsonConvert.DeserializeObject<InportQShootingRangeBop>(jsonStr);
        //                    resultMessage = await DealShootData(ReturnBopTaskOutDto);
        //                    ////曲冰修改
        //                    //backTask.FilePath =;
        //                    // Tasks.Add(backTask);
        //                }
        //            }
        //            //Dto.TableReturnDto.Technique.BackTaskInput taskInput = new Dto.TableReturnDto.Technique.BackTaskInput();
        //            //taskInput.BackTask = Tasks;


        //            if (resultMessage.code == 0)
        //            {
        //                resultMessage.code = 0;
        //                resultMessage.Message = jsonName + "上传成功!";
        //                return resultMessage;
        //            }
        //            else
        //            {
        //                resultMessage.code = 1;
        //                resultMessage.Message = resultMessage.Message;
        //                return resultMessage;
        //            }




        //            ////获取传入文件的md5值
        //            //var md = GetMD5HashFromFile(filePath);
        //            ////判断上传的文件的md5是否相同
        //            //if (md == md5)
        //            //{

        //            //}
        //            //else
        //            //{
        //            //    resultMessage.code = 1;
        //            //    resultMessage.Message = "Md5值不符,请重新上传";
        //            //    return resultMessage;

        //            //}

        //        }
        //        else
        //        {
        //            resultMessage.code = 1;
        //            resultMessage.Message = "文件不能为空";
        //            return resultMessage;
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        resultMessage.code = 1;
        //        resultMessage.Message = ex.Message;
        //        return resultMessage;
        //    }

        //}
        /// <summary>
        /// 清洗数据
        /// </summary>
        /// <param name="rshootingRangeBop"></param>
        /// <param name="ReturnBopTaskOutDto"></param>
        /// <returns></returns>
        [UnitOfWork(false)]
        private async Task deleteData(ExportQShootingRangeBop rshootingRangeBop, InportQShootingRangeBop ReturnBopTaskOutDto)
        {
            #region 清空记录Pad端传入日志记录的信息 

            if (rshootingRangeBop?.rbopDesc != null)
            {
                _rBopDescRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                _rBopDescRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                var bopDesctran = _rBopDescRepository.GetDbContext().Database.BeginTransaction();

                try
                {

                    _rBopDescRepository.GetDbContext().Database.SetCommandTimeout(600);
                    var parameter = new SqlParameter("Id", rshootingRangeBop.rbopDesc.Id.ToString().ToUpper());
                    //// await _rBopDescRepository.HardDeleteAsync(shootingRangeBop.rbopDesc);
                    _rBopDescRepository.GetDbContext().Database.ExecuteSqlCommand("delete from RbopDescs where Id =@id", parameter);
                    //_unitOfWorkManager.cur.SaveChanges();

                    //  var bopdesc = _rBopDescRepository.FirstOrDefault(t => t.Id == shootingRangeBop.rbopDesc.Id);
                    bopDesctran.Commit();
             
                }
                catch (Exception ex)
                {
                    bopDesctran.Rollback();
                }
                finally
                {
                    // bopDesctran.Dispose();
                }
            }
            if (rshootingRangeBop?.rbopNodes != null)
            {
                _rBopNodeRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                _rBopNodeRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                var bopNodetran = _rBopNodeRepository.GetDbContext().Database.BeginTransaction();

                try
                {
                    _rBopNodeRepository.GetDbContext().Database.SetCommandTimeout(600);
                    var parameter = new SqlParameter("Id", rshootingRangeBop.rbopDesc.Id.ToString().ToUpper());
                    _rBopNodeRepository.GetDbContext().Database.ExecuteSqlCommand("delete from RbopNodes where RbopDescId =@Id", parameter);
                    //  var bopdesc = _rBopDescRepository.FirstOrDefault(t => t.Id == shootingRangeBop.rbopDesc.Id);
                    bopNodetran.Commit();
                    
                }
                catch (Exception ex)
                {

                    bopNodetran.Rollback();
                }
                finally
                {
                    // bopNodetran.Dispose(); 
                }
            }



            if (rshootingRangeBop._editFileList != null && rshootingRangeBop._editFileList.Count > 0) 
            {
                _editFileProcessRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                _editFileProcessRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                var deitFileProcess = _editFileProcessRepository.GetDbContext().Database.BeginTransaction();
                try
                {
                    _editFileProcessRepository.GetDbContext().Database.SetCommandTimeout(600);
                    var parameter = new SqlParameter("Id", rshootingRangeBop._editFileList[0].FileProcessSpecificationId.ToString().ToUpper());
                    //// await _rBopDescRepository.HardDeleteAsync(shootingRangeBop.rbopDesc);
                    _editFileProcessRepository.GetDbContext().Database.ExecuteSqlCommand("delete from EditFileProcess where FileProcessSpecificationId =@Id", parameter);
                    //_unitOfWorkManager.cur.SaveChanges();

                    //  var bopdesc = _rBopDescRepository.FirstOrDefault(t => t.Id == shootingRangeBop.rbopDesc.Id);
                    deitFileProcess.Commit();
                    //var tempBopdesc = ReturnBopTaskOutDto.rbopDesc;
                    //List<RbopDesc> rbopDescs = new List<RbopDesc>();
                    //rbopDescs.Add(tempBopdesc);
                    //await _rBopDescRepository.GetDbContext().BulkInsertAsync(rbopDescs);

                }
                catch (Exception ex)
                {
                    deitFileProcess.Rollback();
                }
                finally
                {
                    // bopDesctran.Dispose();
                }
            }
            //20221122
            if (rshootingRangeBop.ClearSignatureRecord != null && rshootingRangeBop.ClearSignatureRecord.Count > 0) 
            {
                _clearSignatureRecordRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                _clearSignatureRecordRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                var clearSigna = _clearSignatureRecordRepository.GetDbContext().Database.BeginTransaction();
                try
                {
                    _clearSignatureRecordRepository.GetDbContext().Database.SetCommandTimeout(600);
                    var parameter = new SqlParameter("Id", rshootingRangeBop.ClearSignatureRecord[0].FileId.ToString().ToUpper());
                    //// await _rBopDescRepository.HardDeleteAsync(shootingRangeBop.rbopDesc);
                    _clearSignatureRecordRepository.GetDbContext().Database.ExecuteSqlCommand("delete from ClearSignatureRecord where FileId =@id", parameter);
                    //_unitOfWorkManager.cur.SaveChanges();

                    //  var bopdesc = _rBopDescRepository.FirstOrDefault(t => t.Id == shootingRangeBop.rbopDesc.Id);
                    clearSigna.Commit();
                    //var tempBopdesc = ReturnBopTaskOutDto.rbopDesc;
                    //List<RbopDesc> rbopDescs = new List<RbopDesc>();
                    //rbopDescs.Add(tempBopdesc);
                    //await _rBopDescRepository.GetDbContext().BulkInsertAsync(rbopDescs);
                }
                catch (Exception ex)
                {
                    clearSigna.Rollback();
                }
                finally
                {
                    // bopDesctran.Dispose();
                }
            }

            if (rshootingRangeBop.rTechniqueEntities != null && rshootingRangeBop.rTechniqueEntities.Count > 0)
            {
               
                _rtechniqueEntity.GetDbContext().Database.AutoTransactionsEnabled = false;
                _rtechniqueEntity.GetDbContext().Database.CurrentTransaction?.Dispose();
                var tran = _rtechniqueEntity.GetDbContext().Database.BeginTransaction();

                try
                {
                    _rtechniqueEntity.GetDbContext().Database.SetCommandTimeout(600);
                    foreach (var item in rshootingRangeBop.rTechniqueEntities)
                    {
                        var parameter = new SqlParameter("Id", item.Id.ToString().ToUpper());
                        _rtechniqueEntity.GetDbContext().Database.ExecuteSqlCommand("delete from RTechniqueEntities where Id =@Id", parameter);
                    }
                    tran.Commit();
                    //_rtechniqueEntity.GetDbContext().SaveChanges();
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                }
                finally
                {

                    // tran.Dispose();
                }
            }


            if (rshootingRangeBop.rTableBases != null && rshootingRangeBop.rTableBases.Count > 0)
            {
                _rTableBaseEntity.GetDbContext().Database.AutoTransactionsEnabled = false;
                _rTableBaseEntity.GetDbContext().Database.CurrentTransaction?.Dispose();
                var tran = _rTableBaseEntity.GetDbContext().Database.BeginTransaction();
                try
                {
                    _rTableBaseEntity.GetDbContext().Database.SetCommandTimeout(600);
                    foreach (var item in rshootingRangeBop.rTableBases)
                    {
                        var parameter = new SqlParameter("Id", item.Id.ToString().ToUpper());
                        _rTableBaseEntity.GetDbContext().Database.ExecuteSqlCommand("delete from RFormBases where Id =@Id", parameter);
                    }
                    tran.Commit();
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                }
                finally
                {
                    //   tran.Dispose();
                }

            }
            if (rshootingRangeBop.RLoadPieceEntities != null && rshootingRangeBop.RLoadPieceEntities.Count > 0)
            {

                _rLoadPieceRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                _rLoadPieceRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                var tran = _rLoadPieceRepository.GetDbContext().Database.BeginTransaction();

                try
                {
                    _rLoadPieceRepository.GetDbContext().Database.SetCommandTimeout(600);
                    foreach (var item in rshootingRangeBop.RLoadPieceEntities)
                    {
                        var parameter = new SqlParameter("Id", item.Id.ToString().ToUpper());

                        _rLoadPieceRepository.GetDbContext().Database.ExecuteSqlCommand("delete from RLoadPieceEntities  where Id =@Id", parameter);

                        // await _rLoadPieceRepository.HardDeleteAsync(item);
                    }
                    tran.Commit();
                  //  await _rLoadPieceRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.RLoadPieceEntities); ;

                }
                catch (Exception ex)
                {
                    tran.Rollback();
                }
                finally
                {
                    //tran.Dispose();

                }
            }
            if (rshootingRangeBop.rMakeResourcesEntities != null && rshootingRangeBop.rMakeResourcesEntities.Count > 0)
            {
                _rMakeResourcesEntityRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                _rMakeResourcesEntityRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                var tran = _rMakeResourcesEntityRepository.GetDbContext().Database.BeginTransaction();

                try
                {
                    _rMakeResourcesEntityRepository.GetDbContext().Database.SetCommandTimeout(600);
                    foreach (var item in rshootingRangeBop.rMakeResourcesEntities)
                    {
                        var parameter = new SqlParameter("Id", item.Id.ToString().ToUpper());

                        _rMakeResourcesEntityRepository.GetDbContext().Database.ExecuteSqlCommand("delete from RMakeResourcesEntity  where Id =@Id", parameter);

                        //    // await _rMakeResourcesEntityRepository.HardDeleteAsync(item);
                    }
                    tran.Commit();
                    //  await _rLoadPieceRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.RLoadPieceEntities); ;
                   // await _rMakeResourcesEntityRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rMakeResourcesEntities);
                }
                catch (Exception ex)
                {
                    tran.Rollback();

                }
                finally
                {
                    //   tran.Dispose();
                }
            }

            if (rshootingRangeBop.rVideoEntities != null && rshootingRangeBop.rVideoEntities.Count > 0)
            {
                _rVideoEntityRepository.GetDbContext().Database.AutoTransactionsEnabled = false;
                _rVideoEntityRepository.GetDbContext().Database.CurrentTransaction?.Dispose();
                var tran = _rVideoEntityRepository.GetDbContext().Database.BeginTransaction();

                try
                {
                    _rVideoEntityRepository.GetDbContext().Database.SetCommandTimeout(600);
                    foreach (var item in rshootingRangeBop.rVideoEntities)
                    {
                        var parameter = new SqlParameter("Id", item.Id.ToString().ToUpper());

                        _rVideoEntityRepository.GetDbContext().Database.ExecuteSqlCommand("delete from RVideoEntity where Id =@Id", parameter);
                        tran.Commit();
                     
                        //_rVideoEntityRepository.GetDbContext().SaveChanges();
                        //tran.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    tran.Rollback();
                }
                finally
                {
                    //  tran.Dispose();
                }
                // CurrentUnitOfWork.SaveChanges();
                #endregion


            }
        }
        [UnitOfWork(false)]
        private async Task<ResultMessage> DealShootData(List<InportQShootingRangeBop> ReturnBopTaskOutDtoData)
        {
            var queryBopDesc = ReturnBopTaskOutDtoData.FirstOrDefault(t => t.rbopDesc != null &&t.rbopNodes!=null);

            bool kg = false;
            bool bfkg = true;
            var user = GetCurrentUser();
            ResultMessage resultMessage = new ResultMessage();
            var bopDesc = await _rBopDescRepository.FirstOrDefaultAsync(d => d.Id == queryBopDesc.rbopDesc.Id);
           
            if (bopDesc == null) 
            {
                var tempBopdesc = queryBopDesc.rbopDesc;
                await _rBopDescRepository.InsertAsync(tempBopdesc);
                if (queryBopDesc.rbopNodes.Count > 0)
                {
                    //  _rBopNodeRepository.GetDbContext().Database.BeginTransaction();
                    foreach (var item in queryBopDesc.rbopNodes)
                    {
                        await _rBopNodeRepository.InsertAsync(item);
                    }
                    //  await _rBopNodeRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rbopNodes);
                    //   _rBopNodeRepository.GetDbContext().Database.CommitTransaction();

                }

                kg = true;
            }

            //添加完成把集合中的对应bopdesc 和 node去除
            int cerid = ReturnBopTaskOutDtoData.FindIndex(x => x.rbopDesc!=null && x.rbopNodes != null);
            ReturnBopTaskOutDtoData.RemoveAt(cerid);
            string tempRoute = "";
            string DateStr = System.DateTime.Now.ToString("yyyyMMddHHmm");
            ExportQShootingRangeBop shootingRangeBop = new ExportQShootingRangeBop();
            foreach (var ReturnBopTaskOutDto in ReturnBopTaskOutDtoData)
            {
                if (kg)
                {
                    try
                    {


                        if (ReturnBopTaskOutDto.rTechniqueEntities.Count > 0)
                        {
                            //   _rtechniqueEntity.GetDbContext().Database.BeginTransaction();
                            foreach (var item in ReturnBopTaskOutDto.rTechniqueEntities)
                            {
                                await _rtechniqueEntity.InsertAsync(item);
                            }
                            //   await _rtechniqueEntity.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rTechniqueEntities);

                            //   _rtechniqueEntity.GetDbContext().Database.CommitTransaction();
                        }
                        if (ReturnBopTaskOutDto.RLoadPieceEntities.Count > 0)
                        {
                            //   _rLoadPieceRepository.GetDbContext().Database.BeginTransaction();
                            foreach (var item in ReturnBopTaskOutDto.RLoadPieceEntities)
                            {
                                await _rLoadPieceRepository.InsertAsync(item);
                            }
                            //  await _rLoadPieceRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.RLoadPieceEntities);

                            //   _rLoadPieceRepository.GetDbContext().Database.CommitTransaction();
                        }
                        if (ReturnBopTaskOutDto.rMakeResourcesEntities.Count > 0)
                        {
                            // _rMakeResourcesEntityRepository.GetDbContext().Database.BeginTransaction();
                            foreach (var item in ReturnBopTaskOutDto.rMakeResourcesEntities)
                            {
                                await _rMakeResourcesEntityRepository.InsertAsync(item);
                            }
                            //  await _rMakeResourcesEntityRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rMakeResourcesEntities);
                            //  _rMakeResourcesEntityRepository.GetDbContext().Database.CommitTransaction();
                        }
                        if (ReturnBopTaskOutDto.rVideoEntities.Count > 0)
                        {
                            //  _rVideoEntityRepository.GetDbContext().Database.BeginTransaction();
                            foreach (var item in ReturnBopTaskOutDto.rVideoEntities)
                            {
                                await _rVideoEntityRepository.InsertAsync(item);
                            }
                            // await _rVideoEntityRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rVideoEntities);
                            // _rVideoEntityRepository.GetDbContext().Database.CommitTransaction();
                        }

                        if (ReturnBopTaskOutDto.rTableBases.Count > 0)
                        {
                            foreach (var item in ReturnBopTaskOutDto.rTableBases)
                            {
                                RConvertFormBase cFormbase = new RConvertFormBase(
                                 item.Id, item.FormName, item.SerialNum, item.RWorkStepEntityId, item.RProcessesEntityId, item.Sort, item.Deptment, item.RecordRemark,
                                 //item.InspectionSignature, item.RecordRequirements, item.MultiMedia, item.MeasuredResult, item.Environment,
                                 item.ParentProductNum, item.ParentProductNum_DisplayName, item.ParentProductName, item.ParentProductName_DisplayName, item.FisrtDrawingNum, item.FisrtDrawingNum_DisplayName, item.FirstDrawingName, item.FirstDrawingName_DisplayName, item.SecondDrawingNum, item.SecondDrawingNum_DisplayName, item.SecondDrawingName, item.SecondDrawingName_DisplayName, item.ProductNum, item.ProductNum_DisplayName, item.Model, item.Model_DisplayName, item.RecordElement, item.RecordElement_DisplayName, item.RecordItem, item.RecordItem_DisplayName, item.ToolUsed, item.ToolUsed_DisplayName, item.AbnormalRecord, item.AbnormalRecord_DisplayName, item.Certificate, item.Certificate_DisplayName, item.SecondToolUsed, item.SecondToolUsed_DisplayName, item.ThirdToolUsed, item.ThirdToolUsed_DisplayName, item.ParamCode, item.ParamCode_DisplayName
                                );
                                if (item.InspectionSignature != null)
                                {
                                    cFormbase.InspectionSignature = cFormbase.SetInspectionSignature(item.InspectionSignature.InspectionSignatureName, item.InspectionSignature.FirstOperator, item.InspectionSignature.FirstOperator_DisplayName, item.InspectionSignature.FirstOperatorData, item.InspectionSignature.FirstOperatorData_DisplayName, item.InspectionSignature.SecondOperator, item.InspectionSignature.SecondOperator_DisplayName, item.InspectionSignature.SecondOperatorData, item.InspectionSignature.SecondOperatorData_DisplayName, item.InspectionSignature.ThirdOperator, item.InspectionSignature.ThirdOperator_DisplayName, item.InspectionSignature.ThirdOperatorData, item.InspectionSignature.ThirdOperatorData_DisplayName, item.InspectionSignature.FourthOperator, item.InspectionSignature.FourthOperator_DisplayName, item.InspectionSignature.FourthOperatorData, item.InspectionSignature.FourthOperatorData_DisplayName, item.InspectionSignature.FifthOperator, item.InspectionSignature.FifthOperator_DisplayName, item.InspectionSignature.FifthOperatorData, item.InspectionSignature.FifthOperatorData_DisplayName);
                                }
                                if (item.RecordRequirements != null)
                                {
                                    cFormbase.RecordRequirements = cFormbase.SetRecordRequirements(item.RecordRequirements.RecordLocation, item.RecordRequirements.RecordLocation_DisplayName, item.RecordRequirements.RecordStatus, item.RecordRequirements.RecordStatus_DisplayName, item.RecordRequirements.RecordRequire, item.RecordRequirements.RecordRequire_DisplayName, item.RecordRequirements.RecordMainopoint, item.RecordRequirements.RecordMainopoint_DisplayName, item.RecordRequirements.DesignerDemand, item.RecordRequirements.DesignerDemand_DisplayName, item.RecordRequirements.ProcessorDemand, item.RecordRequirements.ProcessorDemand_DisplayName, item.RecordRequirements.Remarks, item.RecordRequirements.Remarks_DisplayName);
                                }
                                if (item.MultiMedia != null)
                                {
                                    cFormbase.MultiMedia = cFormbase.SetMultiMedia(item.MultiMedia.PhotoNo, item.MultiMedia.PhotoNo_DisplayName, item.MultiMedia.SecondPhotoNo, item.MultiMedia.SecondPhotoNo_DisplayName, item.MultiMedia.ThirdPhotoNo, item.MultiMedia.ThirdPhotoNo_DisplayName, item.MultiMedia.FourthPhotoNo, item.MultiMedia.FourthPhotoNo_DisplayName);
                                }
                                if (item.MeasuredResult != null)
                                {
                                    cFormbase.MeasuredResult = cFormbase.SetMeasuredResult(item.MeasuredResult.FirstMeasuredValues, item.MeasuredResult.FirstMeasuredValues_DisplayName, item.MeasuredResult.SecondMeasuredValues, item.MeasuredResult.SecondMeasuredValues_DisplayName, item.MeasuredResult.ThirdMeasuredValues, item.MeasuredResult.ThirdMeasuredValues_DisplayName, item.MeasuredResult.FourthMeasuredValues, item.MeasuredResult.FourthMeasuredValues_DisplayName, item.MeasuredResult.FirstConfirmResult, item.MeasuredResult.FirstConfirmResult_DisplayName, item.MeasuredResult.SecondConfirmResult, item.MeasuredResult.SecondConfirmResult_DisplayName, item.MeasuredResult.ThirdConfirmResult, item.MeasuredResult.ThirdConfirmResult_DisplayName, item.MeasuredResult.MeasuredActual, item.MeasuredResult.MeasuredActual_DisplayName);
                                }
                                if (item.Environment != null)
                                {
                                    cFormbase.Environment = cFormbase.SetEnvironment(item.Environment.Temperature, item.Environment.Temperature_DisplayName, item.Environment.Humidity, item.Environment.Humidity_DisplayName, item.Environment.AtmPressure, item.Environment.AtmPressure_DisplayName);
                                }
                                await _rConvertFormBaseEntity.InsertAsync(cFormbase);
                                //  rConvert.Add(cFormbase);

                            }
                            // await _rConvertFormBaseEntity.GetDbContext().BulkInsertAsync(rConvert);
                        }
                        if (ReturnBopTaskOutDto._editFileList != null)
                        {
                            foreach (var item in ReturnBopTaskOutDto._editFileList)
                            {
                                _editFileProcessRepository.Insert(item);
                            }
                        }
                        if (ReturnBopTaskOutDto.ClearSignatureRecord != null)
                        {
                            foreach (var item in ReturnBopTaskOutDto.ClearSignatureRecord)
                            {
                                _clearSignatureRecordRepository.Insert(item);
                            }
                        }
                        //await _unitOfWorkManager.Current.SaveChangesAsync();
                        //CurrentUnitOfWork.SaveChanges();
                    }

                    catch (Exception ex)
                    {

                        ConfigHelper.CreateLogText("DealShootData:"+ex.ToString());
                        resultMessage.code = 1;
                        return resultMessage;
                    }

                }
                else
                {
                    if (bfkg) 
                    {
                        #region 先创建备份
                      
                        shootingRangeBop.rbopDesc = bopDesc;
                        var bopNodeList = _rBopNodeRepository.GetAll().Where(d => d.RbopDescId == queryBopDesc.rbopDesc.Id);
                        List<string> techniqueNumbers = new List<string>();
                        if (bopNodeList.Count() > 0)
                        {
                            shootingRangeBop.rbopNodes.AddRange(bopNodeList);

                            var tech = (from cc in _rtechniqueEntity.GetAll().Include(d => d.ProcessesEntities).ThenInclude(d => d.WorkStepEntities)
                                        join mm in bopNodeList on cc.Id equals mm.RtechniqueEntityId
                                        select cc);
                            if (tech.Count() > 0)
                            {
                                techniqueNumbers.AddRange(tech.Select(d => d.TechniqueNumber));
                                shootingRangeBop.rTechniqueEntities.AddRange(tech);

                                //var pro = (from cc in _rprocessesEntity.GetAll()
                                //           join mm in tech on cc.RTechniqueEntityId equals mm.Id
                                //           select cc);

                                var work = (from cc in _rworkStepEntity.GetAll()
                                            join mm in tech on cc.RTechniqueEntityId equals mm.Id
                                            select cc);

                                var table = (from cc in _rTableBaseEntity.GetAllIncluding(a => a.RecordRequirements, b => b.InspectionSignature, c => c.MeasuredResult, d => d.Environment, e => e.MultiMedia)
                                             join mm in work on cc.RWorkStepEntityId equals mm.Id
                                             select cc);
                                if (table.Count() > 0)
                                {
                                    shootingRangeBop.rTableBases.AddRange(table);
                                }

                                var load = (from cc in _rLoadPieceRepository.GetAll()
                                            join mm in work on cc.RWorkStepEntityId equals mm.Id
                                            select cc);
                                if (load.Count() > 0)
                                {
                                    shootingRangeBop.RLoadPieceEntities.AddRange(load);
                                }
                                var make = (from cc in _rMakeResourcesEntityRepository.GetAll()
                                            join mm in work on cc.RWorkStepEntityId equals mm.Id
                                            select cc);
                                if (make.Count() > 0)
                                {
                                    shootingRangeBop.rMakeResourcesEntities.AddRange(make);
                                }

                                var video = (from cc in _rVideoEntityRepository.GetAll()
                                             join mm in work on cc.RWorkStepEntityId equals mm.Id
                                             select cc);
                                if (video.Count() > 0)
                                {
                                    shootingRangeBop.rVideoEntities.AddRange(video);
                                }
                              

                                var editFileList = (from cc in _editFileProcessRepository.GetAll().AsNoTracking().Include(d => d.EditFileProcessInfos).ThenInclude(a => a.EditFileStepInfos)
                    .ThenInclude(c => c.EditFileTableInfos).ThenInclude(c => c.EditFileRowInfos).ThenInclude(d => d.EditFileTableDataInfos)
                  .Include(d => d.EditFileProcessInfos).ThenInclude(a => a.EditFileStepInfos).ThenInclude(c => c.EditFileTableInfos)
                  .ThenInclude(c => c.EditFileTableStructInfos)
                                                    join mm in tech on cc.RTechniqueEntityId equals mm.Id
                                                    select cc);
                                if (editFileList.Count() > 0)
                                {
                                    shootingRangeBop._editFileList.AddRange(editFileList);
                                }

                                var clearSignatureRecord = (from cc in _clearSignatureRecordRepository.GetAll()
                                                            join mm in tech on cc.RTechniqueEntityId equals mm.Id
                                                            select cc);
                                if (clearSignatureRecord.Count() > 0)
                                {
                                    shootingRangeBop.ClearSignatureRecord.AddRange(clearSignatureRecord);
                                }
                                //if (ReturnBopTaskOutDto._editFileList[0]!=null) 
                                //{
                                //    var editFileList = _editFileProcessRepository.GetAll().Where(t => t.FileProcessSpecificationId == ReturnBopTaskOutDto._editFileList[0].FileProcessSpecificationId);
                                //    if (editFileList.Count() > 0)
                                //    {
                                //        shootingRangeBop._editFileList.AddRange(editFileList);
                                //    }
                                //}


                                //var clearSignatureRecord = _clearSignatureRecordRepository.GetAll().Where(t => t.FileId == ReturnBopTaskOutDto.ClearSignatureRecord);
                                //if (clearSignatureRecord.Count() > 0)
                                //{
                                //    shootingRangeBop._editFileList.AddRange(editFileList);
                                //}
                                //if (editFileList.Count() > 0)
                                //{
                                //    shootingRangeBop._editFileList.AddRange(editFileList);
                                //}

                            }
                        }



                        string treePath = "../../Bop/rBopShootingRange/BackUp/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/";
                        if (!Directory.Exists(treePath))
                        {
                            Directory.CreateDirectory(treePath);
                        }
                        string treefp = treePath + bopDesc.Model + "_" + bopDesc.LotNo + "_shootRbop.json"; //"_" +System.DateTime.Now.ToString("yyyyMMddHHmm")
                        if (File.Exists(treefp))  // 判断是否已有相同文件 
                        {
                            File.Delete(treefp);
                        }
                        //var treeJson = Newtonsoft.Json.JsonConvert.SerializeObject(shootingRangeBop);
                        //File.WriteAllText(treefp, treeJson);
                        JsonSerializer serializer = new JsonSerializer();
                        StreamWriter sw = new StreamWriter(treefp, true);
                        serializer.Serialize(new JsonTextWriter(sw), shootingRangeBop);
                        sw.Flush();
                        sw.Close();
                        string tempSavePath = Environment.CurrentDirectory + "/wwwroot/Zip/rBopShootingRange/BackUp/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/";
                        if (!Directory.Exists(tempSavePath))
                        {
                            Directory.CreateDirectory(tempSavePath);
                        }
                        string zipTreeName = tempSavePath + bopDesc.Model + "_" + bopDesc.LotNo + "_shootRbop.zip";
                        if (!File.Exists(zipTreeName))
                        {
                            ZipFile.CreateFromDirectory(treePath, zipTreeName);
                            //File.Delete(zipTreeName);
                        }

                        #endregion
                        //备份地址
                         tempRoute = ConfigHelper.GetAppSetting("App", "GetAppUrl") + "/Zip/rBopShootingRange/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "_shootRbop.zip";
                        bfkg = false;
                        #region 清洗数据
                        await deleteData(shootingRangeBop,null);
                        #endregion
                    }



                    try
                    {


                        //  await _rLoadPieceRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.RLoadPieceEntities); ;
                        // await _rMakeResourcesEntityRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rMakeResourcesEntities);
                        // await _rVideoEntityRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rVideoEntities);



                        #region 覆盖数据

                        if (queryBopDesc.rbopDesc != null)
                        {
                            using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
                            {
                                var descData = _rBopDescRepository.Count(t => t.Id == queryBopDesc.rbopDesc.Id);
                                // tech.Id = SequentialGuidGenerator.Instance.Create();
                                _rBopDescRepository.GetDbContext().Entry(queryBopDesc.rbopDesc).State = EntityState.Detached;
                                if (descData == 0)
                                {
                                    await _rBopDescRepository.InsertAsync(queryBopDesc.rbopDesc);
                                }

                                unitofwork.Complete();
                                queryBopDesc.rbopDesc = null;
                            }
                        }
                        if (queryBopDesc.rbopNodes != null)
                        {
                            using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
                            {

                                foreach (var node in queryBopDesc.rbopNodes)
                                {
                                    var techData = _rBopNodeRepository.Count(t => t.Id == node.Id);
                                    // tech.Id = SequentialGuidGenerator.Instance.Create();
                                    _rBopNodeRepository.GetDbContext().Entry(node).State = EntityState.Detached;
                                    if (techData == 0)
                                    {
                                        await _rBopNodeRepository.InsertAsync(node);
                                    }
                                }
                                unitofwork.Complete();
                                queryBopDesc.rbopNodes = null;
                            }
                        }

                        if (ReturnBopTaskOutDto.RLoadPieceEntities.Count > 0)
                        {
                            using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
                            {
                                ReturnBopTaskOutDto.RLoadPieceEntities.ForEach(t =>
                                {
                                    t.CreatorUserId = user.Id;
                                });
                                await _rLoadPieceRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.RLoadPieceEntities);
                                unitofwork.Complete();
                            }
                              
                        }

                        if (ReturnBopTaskOutDto.rMakeResourcesEntities.Count > 0)
                        {
                            using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
                            {
                                ReturnBopTaskOutDto.rMakeResourcesEntities.ForEach(t =>
                                {
                                    t.CreatorUserId = user.Id;
                                });
                                await _rMakeResourcesEntityRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rMakeResourcesEntities);
                                unitofwork.Complete();
                            }
                               
                        }

                        if (ReturnBopTaskOutDto.rVideoEntities.Count > 0)
                        {

                            using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
                            {
                                ReturnBopTaskOutDto.rVideoEntities.ForEach(t =>
                                {
                                    t.CreatorUserId = user.Id;
                                });
                                await _rVideoEntityRepository.GetDbContext().BulkInsertAsync(ReturnBopTaskOutDto.rVideoEntities);
                                unitofwork.Complete();
                            }
                               
                        }

                        if (ReturnBopTaskOutDto.rTechniqueEntities != null && ReturnBopTaskOutDto.rTechniqueEntities.Count > 0)
                        {

                            using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
                            {

                                foreach (var tech in ReturnBopTaskOutDto.rTechniqueEntities)
                                {
                                    var techData = _rtechniqueEntity.Count(t => t.Id == tech.Id);
                                    // tech.Id = SequentialGuidGenerator.Instance.Create();
                                    _rtechniqueEntity.GetDbContext().Entry(tech).State = EntityState.Detached;
                                    if (techData == 0)
                                    {
                                        await _rtechniqueEntity.InsertAsync(tech);
                                    }
                                }
                                unitofwork.Complete();
                            }
                        }
                            using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
                            {

                                foreach (var tech in ReturnBopTaskOutDto.ClearSignatureRecord)
                                {
                                    var clearDarta = _clearSignatureRecordRepository.Count(t => t.FileId == tech.FileId);
                                    // tech.Id = SequentialGuidGenerator.Instance.Create();
                                    _rtechniqueEntity.GetDbContext().Entry(tech).State = EntityState.Detached;
                                    if (clearDarta == 0)
                                    {
                                        await _clearSignatureRecordRepository.InsertAsync(tech);
                                    }
                                }
                                unitofwork.Complete();
                            }
                            using (var unitofwork = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
                            {

                                foreach (var tech in ReturnBopTaskOutDto._editFileList)
                                {
                                    var editDarta = _editFileProcessRepository.Count(t => t.FileProcessSpecificationId == tech.FileProcessSpecificationId);
                                    // tech.Id = SequentialGuidGenerator.Instance.Create();
                                    _rtechniqueEntity.GetDbContext().Entry(tech).State = EntityState.Detached;
                                    if (editDarta == 0)
                                    {
                                        await _editFileProcessRepository.InsertAsync(tech);
                                    }
                                }
                                unitofwork.Complete();
                            }
                        using (var unitofworkBase = _unitOfWorkManager.Begin(System.Transactions.TransactionScopeOption.RequiresNew))
                        {
                            if (ReturnBopTaskOutDto.rTableBases.Count > 0)
                            {
                                foreach (var item in ReturnBopTaskOutDto.rTableBases)
                                {
                                    // _rConvertFormBaseEntity.GetDbContext().Entry(item).State = EntityState.Detached;
                                    RConvertFormBase cFormbase = new RConvertFormBase(
                                     item.Id, item.FormName, item.SerialNum, item.RWorkStepEntityId, item.RProcessesEntityId, item.Sort, item.Deptment, item.RecordRemark,
                                     //item.InspectionSignature, item.RecordRequirements, item.MultiMedia, item.MeasuredResult, item.Environment,
                                     item.ParentProductNum, item.ParentProductNum_DisplayName, item.ParentProductName, item.ParentProductName_DisplayName, item.FisrtDrawingNum, item.FisrtDrawingNum_DisplayName, item.FirstDrawingName, item.FirstDrawingName_DisplayName, item.SecondDrawingNum, item.SecondDrawingNum_DisplayName, item.SecondDrawingName, item.SecondDrawingName_DisplayName, item.ProductNum, item.ProductNum_DisplayName, item.Model, item.Model_DisplayName, item.RecordElement, item.RecordElement_DisplayName, item.RecordItem, item.RecordItem_DisplayName, item.ToolUsed, item.ToolUsed_DisplayName, item.AbnormalRecord, item.AbnormalRecord_DisplayName, item.Certificate, item.Certificate_DisplayName, item.SecondToolUsed, item.SecondToolUsed_DisplayName, item.ThirdToolUsed, item.ThirdToolUsed_DisplayName, item.ParamCode, item.ParamCode_DisplayName
                                    );
                                    if (item.InspectionSignature != null)
                                    {
                                        cFormbase.InspectionSignature = cFormbase.SetInspectionSignature(item.InspectionSignature.InspectionSignatureName, item.InspectionSignature.FirstOperator, item.InspectionSignature.FirstOperator_DisplayName, item.InspectionSignature.FirstOperatorData, item.InspectionSignature.FirstOperatorData_DisplayName, item.InspectionSignature.SecondOperator, item.InspectionSignature.SecondOperator_DisplayName, item.InspectionSignature.SecondOperatorData, item.InspectionSignature.SecondOperatorData_DisplayName, item.InspectionSignature.ThirdOperator, item.InspectionSignature.ThirdOperator_DisplayName, item.InspectionSignature.ThirdOperatorData, item.InspectionSignature.ThirdOperatorData_DisplayName, item.InspectionSignature.FourthOperator, item.InspectionSignature.FourthOperator_DisplayName, item.InspectionSignature.FourthOperatorData, item.InspectionSignature.FourthOperatorData_DisplayName, item.InspectionSignature.FifthOperator, item.InspectionSignature.FifthOperator_DisplayName, item.InspectionSignature.FifthOperatorData, item.InspectionSignature.FifthOperatorData_DisplayName);
                                    }
                                    if (item.RecordRequirements != null)
                                    {
                                        cFormbase.RecordRequirements = cFormbase.SetRecordRequirements(item.RecordRequirements.RecordLocation, item.RecordRequirements.RecordLocation_DisplayName, item.RecordRequirements.RecordStatus, item.RecordRequirements.RecordStatus_DisplayName, item.RecordRequirements.RecordRequire, item.RecordRequirements.RecordRequire_DisplayName, item.RecordRequirements.RecordMainopoint, item.RecordRequirements.RecordMainopoint_DisplayName, item.RecordRequirements.DesignerDemand, item.RecordRequirements.DesignerDemand_DisplayName, item.RecordRequirements.ProcessorDemand, item.RecordRequirements.ProcessorDemand_DisplayName, item.RecordRequirements.Remarks, item.RecordRequirements.Remarks_DisplayName);
                                    }
                                    if (item.MultiMedia != null)
                                    {
                                        cFormbase.MultiMedia = cFormbase.SetMultiMedia(item.MultiMedia.PhotoNo, item.MultiMedia.PhotoNo_DisplayName, item.MultiMedia.SecondPhotoNo, item.MultiMedia.SecondPhotoNo_DisplayName, item.MultiMedia.ThirdPhotoNo, item.MultiMedia.ThirdPhotoNo_DisplayName, item.MultiMedia.FourthPhotoNo, item.MultiMedia.FourthPhotoNo_DisplayName);
                                    }
                                    if (item.MeasuredResult != null)
                                    {
                                        cFormbase.MeasuredResult = cFormbase.SetMeasuredResult(item.MeasuredResult.FirstMeasuredValues, item.MeasuredResult.FirstMeasuredValues_DisplayName, item.MeasuredResult.SecondMeasuredValues, item.MeasuredResult.SecondMeasuredValues_DisplayName, item.MeasuredResult.ThirdMeasuredValues, item.MeasuredResult.ThirdMeasuredValues_DisplayName, item.MeasuredResult.FourthMeasuredValues, item.MeasuredResult.FourthMeasuredValues_DisplayName, item.MeasuredResult.FirstConfirmResult, item.MeasuredResult.FirstConfirmResult_DisplayName, item.MeasuredResult.SecondConfirmResult, item.MeasuredResult.SecondConfirmResult_DisplayName, item.MeasuredResult.ThirdConfirmResult, item.MeasuredResult.ThirdConfirmResult_DisplayName, item.MeasuredResult.MeasuredActual, item.MeasuredResult.MeasuredActual_DisplayName);
                                    }
                                    if (item.Environment != null)
                                    {
                                        cFormbase.Environment = cFormbase.SetEnvironment(item.Environment.Temperature, item.Environment.Temperature_DisplayName, item.Environment.Humidity, item.Environment.Humidity_DisplayName, item.Environment.AtmPressure, item.Environment.AtmPressure_DisplayName);
                                    }
                                    // rConvert.Add(cFormbase);
                                    await _rConvertFormBaseEntity.InsertAsync(cFormbase);
                                }

                                unitofworkBase.Complete();
                                //var rcont = rConvert.Take(50).ToList();
                                //foreach (RConvertFormBase in rcont)
                                //{

                                //}
                                //    await _rConvertFormBaseEntity.GetDbContext().BulkInsertAsync(rcont);


                                // await _rConvertFormBaseEntity.GetDbContext().BulkInsertAsync(rConvert);
                                // await _unitOfWorkManager.Current.SaveChangesAsync();
                            }
                        }



                    }
                    catch (Exception ex)
                    {

                        ConfigHelper.CreateLogText(ex.ToString());
                        resultMessage.code = 1;
                        return resultMessage;
                    }
                

                }
            }
            resultMessage.code = 0;
            resultMessage.Message = "数据覆盖成功!原数据备份路径:" + tempRoute;
            return resultMessage;

            //List<RConvertFormBase> rConvert = new List<RConvertFormBase>();
        
            #endregion

            //resultMessage.code = 0;
            //return resultMessage;
        }


        /// <summary>
        /// 靶场导出资料包
        /// </summary>
        /// <param name="bopDescId"></param>
        /// <returns></returns>
        public ResultMessage GetDataPackageSubcontract(List<Guid> techGuid, List<Guid> bopDescId)
        {
            ResultMessage resultMessage = new ResultMessage();
            try
            {
                string techidStr = "";
                if (techGuid.Count > 0)
                {
                    techidStr = string.Join(",", techGuid);
                }
                else
                {
                    resultMessage.code = 1;
                    resultMessage.Message = "请选择规程文件";
                    return resultMessage;
                }

                //获取靶场 文件 然后拷贝 打包 
                var bopDesc = _rBopDescRepository.Get(bopDescId[0]);
                var query = (from cc in _rBopNodeRepository.GetAll().Where(d => d.RtechniqueEntityId != null && d.RbopDescId == bopDescId[0])
                             join mm in _rtechniqueEntity.GetAll() on cc.RtechniqueEntityId equals mm.Id
                             where techidStr.Contains(mm.Id.ToString())
                             select mm.TechniqueNumber).ToList();
                if (query.Count > 0)
                {
                    String DateStr = System.DateTime.Now.ToString("yyyyMMddHHmm");
                    string treePath = "../../Bop/rDataPackage/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "_DataPackage" + "/";
                    if (!Directory.Exists(treePath))
                    {
                        Directory.CreateDirectory(treePath);
                    }
                    string fileBopRootDir = ConfigHelper.GetAppSetting("App", "FileRootPath");
                    for (int i = 0; i < query.Count; i++)
                    {
                        string srcPatch = Environment.CurrentDirectory + "/wwwroot/" + fileBopRootDir + "/" + query[i] + "/";
                        if (Directory.Exists(srcPatch))
                        {
                            string desPath = treePath + query[i] + "/";
                            if (!Directory.Exists(desPath))
                            {
                                Directory.CreateDirectory(desPath);
                            }
                            if (CopyDir(srcPatch, desPath))
                            {
                            }
                            else
                            {
                                throw new UserFriendlyException("拷贝文件失败！");
                            }
                        }
                    }
                    string fileSavePath = Environment.CurrentDirectory + "/wwwroot/Zip/rDataPackage/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/";
                    if (!Directory.Exists(fileSavePath))
                    {
                        Directory.CreateDirectory(fileSavePath);
                    }
                    string zipTreeName = fileSavePath + bopDesc.Model + "_" + bopDesc.LotNo + "_DataPackage.zip";
                    if (File.Exists(zipTreeName))
                    {
                        File.Delete(zipTreeName);
                    }
                    ZipFile.CreateFromDirectory(treePath, zipTreeName);
                    resultMessage.code = 0;
                    resultMessage.Message = ConfigHelper.GetAppSetting("App", "GetAppUrl") + "/Zip/rDataPackage/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "_DataPackage.zip";
                    return resultMessage;
                }
                else
                {
                    resultMessage.code = 1;
                    resultMessage.Message = "服务器未查找到文件！";
                    return resultMessage;
                }

            }
            catch (Exception ex)
            {
                resultMessage.code = 1;
                resultMessage.Message = ex.Message;
                return resultMessage;
            }
        }


        /// <summary>
        /// 靶场导出资料包
        /// </summary>
        /// <param name="bopDescId"></param>
        /// <returns></returns>
        public ResultMessage GetDataPackage(Guid bopDescId)
        {
            ResultMessage resultMessage = new ResultMessage();
            try
            {
                //获取靶场 文件 然后拷贝 打包 
                var bopDesc = _rBopDescRepository.Get(bopDescId);
                var query = (from cc in _rBopNodeRepository.GetAll().Where(d => d.RtechniqueEntityId != null && d.RbopDescId == bopDescId)
                             join mm in _rtechniqueEntity.GetAll() on cc.RtechniqueEntityId equals mm.Id
                             select mm.TechniqueNumber).ToList();

                if (query.Count > 0)
                {
                    String DateStr = System.DateTime.Now.ToString("yyyyMMddHHmm");
                    string treePath = "../../Bop/rDataPackage/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "_DataPackage" + "/";
                    if (!Directory.Exists(treePath))
                    {
                        Directory.CreateDirectory(treePath);
                    }
                    string fileBopRootDir = ConfigHelper.GetAppSetting("App", "FileRootPath");
                    for (int i = 0; i < query.Count; i++)
                    {
                        string srcPatch = Environment.CurrentDirectory + "/wwwroot/" + fileBopRootDir + "/" + query[i] + "/";
                        if (Directory.Exists(srcPatch))
                        {
                            string desPath = treePath + query[i] + "/";
                            if (!Directory.Exists(desPath))
                            {
                                Directory.CreateDirectory(desPath);
                            }
                            if (CopyDir(srcPatch, desPath))
                            {
                            }
                            else
                            {
                                throw new UserFriendlyException("拷贝文件失败！");
                            }
                        }
                    }
                    string fileSavePath = Environment.CurrentDirectory + "/wwwroot/Zip/rDataPackage/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/";
                    if (!Directory.Exists(fileSavePath))
                    {
                        Directory.CreateDirectory(fileSavePath);
                    }
                    string zipTreeName = fileSavePath + bopDesc.Model + "_" + bopDesc.LotNo + "_DataPackage.zip";
                    if (File.Exists(zipTreeName))
                    {
                        File.Delete(zipTreeName);
                    }
                    ZipFile.CreateFromDirectory(treePath, zipTreeName);
                    resultMessage.code = 0;
                    resultMessage.Message = ConfigHelper.GetAppSetting("App", "GetAppUrl") + "/Zip/rDataPackage/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "_DataPackage.zip";
                    return resultMessage;
                }
                else
                {
                    resultMessage.code = 1;
                    resultMessage.Message = "服务器未查找到文件！";
                    return resultMessage;
                }

            }
            catch (Exception ex)
            {
                resultMessage.code = 1;
                resultMessage.Message = ex.Message;
                return resultMessage;
            }
        }
        #endregion

        private string GetMD5HashFromFile(string fileName)
        {
            try
            {
                FileStream file = new FileStream(fileName, FileMode.Open);
                MD5 md5 = new MD5CryptoServiceProvider();
                byte[] retVal = md5.ComputeHash(file);
                file.Close();
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < retVal.Length; i++)
                {
                    sb.Append(retVal[i].ToString("x2"));
                }
                return sb.ToString();
            }
            catch (Exception ex)
            {
                throw new Exception("GetMD5HashFromFile() fail,error:" + ex.Message);
            }
        }

        private bool CopyDir(string srcPath, string aimPath)
        {
            try
            {
                // 检查目标目录是否以目录分割字符结束如果不是则添加
                if (aimPath[aimPath.Length - 1] != System.IO.Path.DirectorySeparatorChar)
                {
                    aimPath += System.IO.Path.DirectorySeparatorChar;
                }
                // 判断目标目录是否存在如果不存在则新建
                if (!System.IO.Directory.Exists(aimPath))
                {
                    System.IO.Directory.CreateDirectory(aimPath);
                }
                // 得到源目录的文件列表，该里面是包含文件以及目录路径的一个数组
                // 如果你指向copy目标文件下面的文件而不包含目录请使用下面的方法
                // string[] fileList = Directory.GetFiles（srcPath）；
                string[] fileList = System.IO.Directory.GetFileSystemEntries(srcPath);
                // 遍历所有的文件和目录
                foreach (string file in fileList)
                {
                    // 先当作目录处理如果存在这个目录就递归Copy该目录下面的文件
                    if (System.IO.Directory.Exists(file))
                    {
                        CopyDir(file, aimPath + System.IO.Path.GetFileName(file));
                    }
                    // 否则直接Copy文件
                    else
                    {
                        System.IO.File.Copy(file, aimPath + System.IO.Path.GetFileName(file), true);
                    }
                }
                return true;
            }
            catch (Exception ex)
            {
                //return false;
                throw new Exception(ex.Message);
            }
        }

        /// <summary>
        /// 归档
        /// </summary>
        /// <param name="rBopDescId"></param>
        /// <returns></returns>
        public async Task<ResultMessage> PlaceOnFile(Guid rBopDescId)
        {
            ResultMessage resultMessage = new ResultMessage();
            try
            {
                var rBopDesc = _rBopDescRepository.FirstOrDefault(s => s.Id == rBopDescId);
                if (rBopDesc != null)
                {
                    var rBopNodeListAll = _rBopNodeRepository.GetAll().Where(s => s.RbopDescId == rBopDesc.Id); //&& s.RtechniqueEntityId != null
                    var techList = rBopNodeListAll.Where(s => s.TechniqueEntityId != null);
                    var rBopNodeList = rBopNodeListAll.Where(s => s.RtechniqueEntityId != null);
                    if (techList.Count() == 0)
                    {
                        resultMessage.code = 1;
                        resultMessage.Message = "该任务下没有规程文件";
                        return resultMessage;
                    }
                    if (techList.Count() > rBopNodeList.Count())
                    {
                        resultMessage.code = 1;
                        resultMessage.Message = "该任务下有规程文件没有回传，不能归档";
                        return resultMessage;
                    }
                    if (rBopNodeList != null)
                    {
                        var rTechNotOnFileList = (from rtech in _rtechniqueEntity.GetAll()
                                                  join rbopnode in rBopNodeList on rtech.Id equals rbopnode.RtechniqueEntityId
                                                  select new RTechniqueEntity
                                                  {
                                                      ModuleCode = rtech.ModuleCode,
                                                      ModuleName = rtech.ModuleName
                                                  }).Where(s => s.Status != 7 && s.Status != 8).ToList();
                        if (rTechNotOnFileList.Count() > 0)
                        {
                            resultMessage.code = 1;
                            var teachNames = string.Join("\r\n", (rTechNotOnFileList.Select(s => s.ModuleName)));
                            resultMessage.Message = "该任务下有规程文件没有归档:" + teachNames + "";
                            return resultMessage;
                        }
                    }
                    else
                    {
                        resultMessage.code = 1;
                        resultMessage.Message = "该任务下没有规程文件";
                        return resultMessage;
                    }
                    var makeTask = _makeTaskRepository.FirstOrDefault(s => s.ModelId == rBopDesc.ModelId && s.LotNoId == rBopDesc.LotNoId);
                    if (makeTask != null)
                    {
                        if (makeTask.RocketState == "已归档")
                        {
                            resultMessage.code = 1;
                            resultMessage.Message = "该任务已经归档";
                            return resultMessage;
                        }
                        makeTask.RocketState = "已归档";
                        await _makeTaskRepository.UpdateAsync(makeTask);
                        _iOperationHistoryAppService.InsertOperationLogNew(rBopDesc.Id, BusinessTypes.质量数据包管理, OperationTypes.归档, "归档");
                        resultMessage.code = 0;
                        return resultMessage;
                    }
                    else
                    {
                        resultMessage.code = 1;
                        resultMessage.Message = "没找到该任务";
                        return resultMessage;
                    }
                }
                else
                {
                    resultMessage.code = 1;
                    resultMessage.Message = "该数据不存在";
                    return resultMessage;
                }
            }
            catch (Exception ex)
            {
                resultMessage.code = 1;
                resultMessage.Message = ex.Message;
                return resultMessage;
            }
        }

        /// <summary>
        /// 归档下载
        /// </summary>
        /// <param name="bopDescId"></param>
        /// <returns></returns>
        public ResultMessage PlaceOnFileDonland(Guid bopDescId)
        {
            ResultMessage resultMessage = new ResultMessage();
            try
            {
                var bopDesc = _rBopDescRepository.Get(bopDescId);
                var userName = GetCurrentUser().Name;
                String DateStr = System.DateTime.Now.ToString("yyyyMMddHHmm");

                #region 获取靶场数据包导出文件
                ExportQShootingRangeBop shootingRangeBop = new ExportQShootingRangeBop();
                //var bopDesc = _rBopDescRepository.GetAll().Where(d => d.Id == bopDescId).First();
                shootingRangeBop.rbopDesc = bopDesc;
                var bopNodeList = _rBopNodeRepository.GetAll().Where(d => d.RbopDescId == bopDescId);
                List<string> techniqueNumbers = new List<string>();
                if (bopNodeList.Count() > 0)
                {
                    shootingRangeBop.rbopNodes.AddRange(bopNodeList);

                    var tech = (from cc in _rtechniqueEntity.GetAll().Include(d => d.ProcessesEntities).ThenInclude(d => d.WorkStepEntities)
                                join mm in bopNodeList on cc.Id equals mm.RtechniqueEntityId
                                select cc);
                    if (tech.Count() > 0)
                    {
                        techniqueNumbers.AddRange(tech.Select(d => d.TechniqueNumber));
                        shootingRangeBop.rTechniqueEntities.AddRange(tech);

                        var pro = (from cc in _rprocessesEntity.GetAll()
                                   join mm in tech on cc.RTechniqueEntityId equals mm.Id
                                   select cc);

                        var work = (from cc in _rworkStepEntity.GetAll()
                                    join mm in tech on cc.RTechniqueEntityId equals mm.Id
                                    select cc);

                        var table = (from cc in _rTableBaseEntity.GetAllIncluding(a => a.RecordRequirements, b => b.InspectionSignature, c => c.MeasuredResult, d => d.Environment, e => e.MultiMedia)
                                     join mm in work on cc.RWorkStepEntityId equals mm.Id
                                     select cc);
                        if (table.Count() > 0)
                        {
                            shootingRangeBop.rTableBases.AddRange(table);
                        }

                        var load = (from cc in _rLoadPieceRepository.GetAll()
                                    join mm in work on cc.RWorkStepEntityId equals mm.Id
                                    select cc);
                        if (load.Count() > 0)
                        {
                            shootingRangeBop.RLoadPieceEntities.AddRange(load);
                        }
                        var make = (from cc in _rMakeResourcesEntityRepository.GetAll()
                                    join mm in work on cc.RWorkStepEntityId equals mm.Id
                                    select cc);
                        if (make.Count() > 0)
                        {
                            shootingRangeBop.rMakeResourcesEntities.AddRange(make);
                        }

                        var video = (from cc in _rVideoEntityRepository.GetAll()
                                     join mm in work on cc.RWorkStepEntityId equals mm.Id
                                     select cc);
                        if (video.Count() > 0)
                        {
                            shootingRangeBop.rVideoEntities.AddRange(video);
                        }
                    }
                }

                //String DateStr = System.DateTime.Now.ToString("yyyyMMddHHmm");

                string treePathShootingRange = Environment.CurrentDirectory + "/wwwroot/Bop/rBopShootingRange/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/";
                if (!Directory.Exists(treePathShootingRange))
                {
                    Directory.CreateDirectory(treePathShootingRange);
                }
                string treefp = treePathShootingRange + bopDesc.Model + "_" + bopDesc.LotNo + "_shootRbop.json"; //"_" +System.DateTime.Now.ToString("yyyyMMddHHmm")
                if (File.Exists(treefp))  // 判断是否已有相同文件 
                {
                    File.Delete(treefp);
                }
                //var treeJson = Newtonsoft.Json.JsonConvert.SerializeObject(shootingRangeBop);
                //File.WriteAllText(treefp, treeJson);
                JsonSerializer serializer = new JsonSerializer();
                StreamWriter sw = new StreamWriter(treefp, true);
                serializer.Serialize(new JsonTextWriter(sw), shootingRangeBop);
                sw.Flush();
                sw.Close();
                foreach (var item in techniqueNumbers)
                {
                    string path = Environment.CurrentDirectory + "/wwwroot/Bop/rBopShootingRange/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/" + item + "/";
                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }
                    string fp = path + item + ".json"; //"_" +System.DateTime.Now.ToString("yyyyMMddHHmm")
                    if (File.Exists(fp))  // 判断是否已有相同文件 
                    {
                        File.Delete(fp);
                    }
                    string srcPatch = Environment.CurrentDirectory + "/wwwroot/UploadFile/" + item + "/";
                    if (!Directory.Exists(srcPatch))
                    {
                        Directory.CreateDirectory(srcPatch);
                    }
                    if (!CopyDir(srcPatch, path))
                    {
                        resultMessage.code = 1;
                        resultMessage.Message = "复制文件文件失败!";
                        return resultMessage;
                    }
                }
                string fileSavePathShootingRange = Environment.CurrentDirectory + "/wwwroot/Zip/rBopShootingRange/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/";
                if (!Directory.Exists(fileSavePathShootingRange))
                {
                    Directory.CreateDirectory(fileSavePathShootingRange);
                }
                string zipTreeNameShootingRange = fileSavePathShootingRange + bopDesc.Model + "_" + bopDesc.LotNo + "_shootRbop.zip";
                if (File.Exists(zipTreeNameShootingRange))
                {
                    File.Delete(zipTreeNameShootingRange);
                }
                ZipFile.CreateFromDirectory(treePathShootingRange, zipTreeNameShootingRange);
                #endregion

                #region 获取导出资料包
                var query = (from cc in _rBopNodeRepository.GetAll().Where(d => d.RtechniqueEntityId != null && d.RbopDescId == bopDescId)
                             join mm in _rtechniqueEntity.GetAll() on cc.RtechniqueEntityId equals mm.Id
                             select mm.TechniqueNumber).ToList();

                if (query.Count > 0)
                {
                    //String DateStr = System.DateTime.Now.ToString("yyyyMMddHHmm");
                    string treePathDataPackage = Environment.CurrentDirectory + "/wwwroot/Bop/rDataPackage/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "_DataPackage" + "/";
                    if (!Directory.Exists(treePathDataPackage))
                    {
                        Directory.CreateDirectory(treePathDataPackage);
                    }
                    string fileBopRootDir = ConfigHelper.GetAppSetting("App", "FileRootPath");
                    for (int i = 0; i < query.Count; i++)
                    {
                        string srcPatch = Environment.CurrentDirectory + "/wwwroot/" + fileBopRootDir + "/" + query[i] + "/";
                        if (Directory.Exists(srcPatch))
                        {
                            string desPath = treePathDataPackage + query[i] + "/";
                            if (!Directory.Exists(desPath))
                            {
                                Directory.CreateDirectory(desPath);
                            }
                            if (CopyDir(srcPatch, desPath))
                            {
                            }
                            else
                            {
                                resultMessage.code = 1;
                                resultMessage.Message = "没有找到回传的规程文件，请检查数据是否正确！";
                                return resultMessage;
                            }
                        }
                    }
                    string fileSavePathDataPackage = Environment.CurrentDirectory + "/wwwroot/Zip/rDataPackage/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/";
                    if (!Directory.Exists(fileSavePathDataPackage))
                    {
                        Directory.CreateDirectory(fileSavePathDataPackage);
                    }
                    string zipTreeNameDataPackage = fileSavePathDataPackage + bopDesc.Model + "_" + bopDesc.LotNo + "_DataPackage.zip";
                    if (File.Exists(zipTreeNameDataPackage))
                    {
                        File.Delete(zipTreeNameDataPackage);
                    }
                    ZipFile.CreateFromDirectory(treePathDataPackage, zipTreeNameDataPackage);
                }
                else
                {
                    resultMessage.code = 1;
                    resultMessage.Message = "拷贝文件失败！";
                    return resultMessage;
                }
                #endregion

                //将靶场数据包和导出资料包打包压缩并下载
                string resPath = Environment.CurrentDirectory + "/wwwroot/" + "placeOnFilePath" + "/" + DateStr + "/";
                string placeOnFilePath = resPath + bopDesc.Model + "-" + bopDesc.LotNo + "-" + "归档" + "-" + userName + "/";
                var rShootingRangePath = Environment.CurrentDirectory + "/wwwroot/Zip/rBopShootingRange/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/";
                var dataPackagePath = Environment.CurrentDirectory + "/wwwroot/Zip/rDataPackage/" + DateStr + "/" + bopDesc.Model + "_" + bopDesc.LotNo + "/";
                if (!Directory.Exists(placeOnFilePath))
                {
                    Directory.CreateDirectory(placeOnFilePath);
                }
                if (CopyDir(rShootingRangePath, placeOnFilePath))
                {
                }
                if (CopyDir(dataPackagePath, placeOnFilePath))
                {
                }
                string zipTreeName = resPath + bopDesc.Model + "-" + bopDesc.LotNo + "-" + "归档" + "-" + userName + ".zip";
                if (File.Exists(zipTreeName))
                {
                    File.Delete(zipTreeName);
                }
                ZipFile.CreateFromDirectory(placeOnFilePath, zipTreeName);
                _iOperationHistoryAppService.InsertOperationLogNew(bopDescId, BusinessTypes.质量数据包管理, OperationTypes.归档, "归档数据下载");
                resultMessage.code = 0;
                resultMessage.Message = ConfigHelper.GetAppSetting("App", "GetAppUrl") + "/placeOnFilePath/" + DateStr + "/" + bopDesc.Model + "-" + bopDesc.LotNo + "-" + "归档" + "-" + userName + ".zip";
                return resultMessage;
            }
            catch (Exception ex)
            {
                resultMessage.code = 1;
                resultMessage.Message = ex.Message;
                return resultMessage;
            }
        }

        private string GetOperatorUserName(string jsonOperatorStr, string operationName = "")
        {

            if (string.IsNullOrEmpty(jsonOperatorStr))
            {
                return "";
            }
            if (jsonOperatorStr.Contains("user"))
            {
                var jsonOperatorList = JsonConvert.DeserializeObject<List<Operator>>(jsonOperatorStr);
                if (jsonOperatorList != null)
                {
                    if (jsonOperatorList.Count > 0)
                    {
                        var userName = "";
                        foreach (var item in jsonOperatorList)
                        {
                            userName = (userName + "," + item.user).TrimStart(new char[] { ',' }).TrimEnd(new char[] { ',' });
                        }
                        return userName;
                    }
                    else
                    {
                        return "";
                    }
                }
                else
                {
                    return "";
                }
            }
            else
            {
                return "";
            }
        }
        public static bool CompressMulti(List<string> list, string strZipName, bool isDirStruct)
        {
            if (list == null)
            {
                throw new ArgumentNullException("list");
            }
            if (string.IsNullOrEmpty(strZipName))
            {
                throw new ArgumentNullException(strZipName);
            }
            try
            {
                //设置编码，解决压缩文件时中文乱码
                using (var zip = new Ionic.Zip.ZipFile(Encoding.Default))
                {
                    foreach (var path in list)
                    {
                        //取目录名称
                        var fileName = Path.GetFileName(path);
                        //如果是目录
                        if (Directory.Exists(path))
                        {
                            //按目录结构压缩
                            if (isDirStruct)
                            {
                                zip.AddDirectory(path, fileName);
                            }
                            else
                            {
                                //目录下的文件都压缩到Zip的根目录
                                zip.AddDirectory(path);
                            }
                        }
                        if (File.Exists(path))
                        {
                            zip.AddFile(path);
                        }
                    }

                    zip.UseZip64WhenSaving = Ionic.Zip.Zip64Option.Always;
                    //压缩
                    zip.Save(strZipName);
                    return true;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    }
}


